KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm new to qt programming so please don't mind if you find it a noob question. I've added a button to my main window but when I run the code the button is not displayed. Here's my code: mainwindow.cpp #include "mainwindow.h" #include "ui_mainwindow.h" #include <QtWidgets> MainWindow::MainWindow(QWidget *parent) { QPushButton *train_button = new QPushButton(this); train_button->setText(tr("something")); train_button->move(600, 600); train_button->show(); } mainwindow.h #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H MainWindow::~MainWindow() { delete ui; } What should I do?
Tags (comma-separated)
Save Edits
Cancel