parent
fd8dfd90bb
commit
f29499fee6
7 changed files with 72 additions and 6 deletions
@ -1,2 +1,3 @@ |
||||
# Project exclude paths |
||||
/cmake-build-debug/ |
||||
/.idea/ |
@ -0,0 +1,18 @@ |
||||
#pragma once |
||||
|
||||
#include <QWidget> |
||||
#include "OutputWidget.h" |
||||
|
||||
class MainWindow : public QWidget { |
||||
Q_OBJECT |
||||
public: |
||||
explicit MainWindow(QWidget *parent = nullptr); |
||||
public slots: |
||||
void sizeChanged(int newValue); |
||||
private: |
||||
void buildUI(); |
||||
|
||||
OutputWidget* outputWidget = new OutputWidget; |
||||
}; |
||||
|
||||
|
@ -0,0 +1,11 @@ |
||||
|
||||
#pragma once |
||||
|
||||
|
||||
#include <QWidget> |
||||
|
||||
class OutputWidget : public QWidget{ |
||||
|
||||
}; |
||||
|
||||
|
@ -0,0 +1,30 @@ |
||||
#include <QVBoxLayout> |
||||
#include <QSlider> |
||||
#include <iostream> |
||||
#include "../headers/MainWindow.h" |
||||
|
||||
MainWindow::MainWindow(QWidget *parent): QWidget(parent) { |
||||
buildUI(); |
||||
} |
||||
|
||||
void MainWindow::buildUI() { |
||||
|
||||
auto sizeSlider = new QSlider(Qt::Horizontal); |
||||
sizeSlider->setRange(100, 800); |
||||
QSlider::connect(sizeSlider, &QSlider::valueChanged, this, &MainWindow::sizeChanged); |
||||
sizeSlider->setValue(500); |
||||
|
||||
auto controls = new QGridLayout; |
||||
controls->addWidget(sizeSlider); |
||||
|
||||
QVBoxLayout lyt; |
||||
|
||||
lyt.addWidget(outputWidget); |
||||
lyt.addLayout(controls); |
||||
|
||||
setLayout(&lyt); |
||||
} |
||||
|
||||
void MainWindow::sizeChanged(int newValue) { |
||||
std::cout << newValue << std::endl; |
||||
} |
@ -0,0 +1,2 @@ |
||||
|
||||
#include "../headers/OutputWidget.h" |
@ -1,10 +1,11 @@ |
||||
#include <QApplication> |
||||
#include <QPushButton> |
||||
#include "../headers/MainWindow.h" |
||||
|
||||
int main(int argc, char *argv[]) { |
||||
QApplication a(argc, argv); |
||||
QPushButton button("Hello world!", nullptr); |
||||
button.resize(200, 100); |
||||
button.show(); |
||||
|
||||
MainWindow w; |
||||
w.show(); |
||||
|
||||
return QApplication::exec(); |
||||
} |
Loading…
Reference in new issue