set up sqlite func and passed int to determine verse to pull

This commit is contained in:
Daniel Jones 2023-09-01 15:52:30 -05:00
parent e59f08a746
commit e343f2e819
2 changed files with 34 additions and 8 deletions

View File

@ -1,15 +1,25 @@
/*Author: Daniel Jones
*IDE: QT Creator
*Compiler: MinGW
*OS: Windows 10
*Purpose: QT Widget that displays the verse of the day upon Windows 10 bootup.
* Last edited: 9/1/2023
*/
#include "mainwindow.h" #include "mainwindow.h"
#include "./ui_mainwindow.h" #include "./ui_mainwindow.h"
#include <iostream> #include <iostream>
#include <random> #include <random>
void verse_display(); QString verse_display();
std::string sqlite_func(int day);
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."); ui->verse->setText(verse_display());
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
@ -26,16 +36,29 @@ int random_verse(){
} }
//This is the function that will load the verse into the program. //This is the function that will load the verse into the program.
void verse_display() QString verse_display()
{ {
std::string verse_text; std::string verse_text;
int verse_day = random_verse(); int verse_day = random_verse();
std::cout << verse_day << "\n"; verse_text = sqlite_func(verse_day);
return "It is receiving text from verse_display()";
}
std::string sqlite_func(int day){
std::string my_verse;
return my_verse;
} }
void MainWindow::on_exitButton_clicked() void MainWindow::on_exitButton_clicked()
{ {
QApplication::quit(); QApplication::quit();

View File

@ -34,15 +34,18 @@
<widget class="QLabel" name="verse"> <widget class="QLabel" name="verse">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>170</x> <x>10</x>
<y>90</y> <y>20</y>
<width>49</width> <width>361</width>
<height>16</height> <height>161</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>TextLabel</string> <string>TextLabel</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget> </widget>
</widget> </widget>
<widget class="QMenuBar" name="menubar"> <widget class="QMenuBar" name="menubar">