Set label and added random function

This commit is contained in:
Daniel Jones 2023-09-01 15:40:44 -05:00
parent 7fabe91713
commit e59f08a746
4 changed files with 32 additions and 4 deletions

BIN
bread.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 KiB

View File

@ -1,18 +1,40 @@
#include "mainwindow.h"
#include "./ui_mainwindow.h"
#include <iostream>
#include <random>
void verse_display();
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->verse->setText("This is a test.");
}
MainWindow::~MainWindow()
{
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()
{

View File

@ -18,6 +18,8 @@ public:
private slots:
void on_exitButton_clicked();
private:
Ui::MainWindow *ui;
};

View File

@ -11,7 +11,11 @@
</rect>
</property>
<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>
<widget class="QWidget" name="centralwidget">
<widget class="QPushButton" name="exitButton">
@ -27,11 +31,11 @@
<string>Go in Peace</string>
</property>
</widget>
<widget class="QLabel" name="label">
<widget class="QLabel" name="verse">
<property name="geometry">
<rect>
<x>160</x>
<y>130</y>
<x>170</x>
<y>90</y>
<width>49</width>
<height>16</height>
</rect>