Set label and added random function
This commit is contained in:
parent
7fabe91713
commit
e59f08a746
@ -1,18 +1,40 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "./ui_mainwindow.h"
|
#include "./ui_mainwindow.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include <random>
|
||||||
|
void verse_display();
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, ui(new Ui::MainWindow)
|
, ui(new Ui::MainWindow)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
ui->verse->setText("This is a test.");
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
{
|
{
|
||||||
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//As name implies, randomly chooses a number between 1 and 100.
|
||||||
|
int random_verse(){
|
||||||
|
std::random_device rd;
|
||||||
|
std:: uniform_int_distribution<int> dist(1, 100);
|
||||||
|
return dist(rd);
|
||||||
|
}
|
||||||
|
|
||||||
|
//This is the function that will load the verse into the program.
|
||||||
|
void verse_display()
|
||||||
|
{
|
||||||
|
std::string verse_text;
|
||||||
|
int verse_day = random_verse();
|
||||||
|
std::cout << verse_day << "\n";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::on_exitButton_clicked()
|
void MainWindow::on_exitButton_clicked()
|
||||||
{
|
{
|
||||||
|
@ -18,6 +18,8 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void on_exitButton_clicked();
|
void on_exitButton_clicked();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
};
|
};
|
||||||
|
@ -11,7 +11,11 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>MainWindow</string>
|
<string>Daily Bread</string>
|
||||||
|
</property>
|
||||||
|
<property name="windowIcon">
|
||||||
|
<iconset theme="accessories-dictionary">
|
||||||
|
<normaloff>bread.png</normaloff>bread.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<widget class="QPushButton" name="exitButton">
|
<widget class="QPushButton" name="exitButton">
|
||||||
@ -27,11 +31,11 @@
|
|||||||
<string>Go in Peace</string>
|
<string>Go in Peace</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="verse">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>160</x>
|
<x>170</x>
|
||||||
<y>130</y>
|
<y>90</y>
|
||||||
<width>49</width>
|
<width>49</width>
|
||||||
<height>16</height>
|
<height>16</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
Loading…
Reference in New Issue
Block a user