PDA

View Full Version : MSVC C++ project for QT problem...



Pereubu2018
4th July 2018, 13:18
When I put pushbutton in my code like:

// Create the button, make "this" the parent
m_button = new QPushButton("My Button", this);
// set size and location of the button
m_button->setGeometry(QRect(QPoint(100, 100),
QSize(200, 50)));

// Connect button signal to appropriate slot
connect(m_button, SIGNAL (released()), this, SLOT (handleButton()));

and

private slots:
void handleButton();
private:
QPushButton *m_button;

everything works fine but I could not see that button in QDesigner and vice versa when I include push button in my QT form .ui I could not see that at all. It is not only pushbutton but all components what I could pick from WidgetBox. I suspect some problem with seting up include inside Visual C++ projects.

What can I do?

Lesiok
4th July 2018, 14:12
Generally, you can not mix UI creation of one class in code and in GUI Designer. The objects created in the code are not visible in the GUI Designer. It works only in one direction: GUI Designer (ui file) -> program code.

P.S.
Are You working with Visual Studio or with Qt Creator ?

Pereubu2018
4th July 2018, 16:23
I understand what you stated. I worked on Visual Studio. Then I have to double click on MyProgram.ui. It is QTDesigner. Then I can put for example a few buttons on that

12890.

Then I have problem to generate slot to respond on clicked event on button let say button START.
As you can see I cannot see usual option "GO TO SLOTS"

12891

So I can not generate in this way slot which will respond on clicked button "START".
That is problem which I was to resolve from the beginning.

Lesiok
5th July 2018, 08:10
Do you have a Qt plugin installed? Unfortunately, the drawings are unreadable.