PDA

View Full Version : Can't see buttons



robel
14th October 2015, 15:47
Hi,
i create manually my Qt code, all it work perfectely
but when i want to add another widget that contain buttons , when i run my program i can't see the buttons,

Edit: i fix the problem

Added after 57 minutes:

Hi,
I throught that i fixed the problem
but i found that the problem is exist
:crying:
that's my code

MainWindow::MainWindow()
{

mywidget = new Qmywidget(this);

setCentralWidget(mywidget);
widget = new QWidget(this);
widget->setObjectName(QString::fromUtf8(widget"));
widget->setGeometry(QRect(50, 800, 211, 250));

anim = new QToolButton(widget);
anim->setGeometry(QRect(10, 100, 131, 51))/*setGeometry(QRect(0, 10, 71, 31))*/;
anim->setText(QApplication::translate("MainWindow", "Animer", 0, QApplication::UnicodeUTF8));
anim->setCheckable(true);

it's problem of windows size i think but i can't resolve it

anda_skoa
14th October 2015, 18:23
That code doesn't make much sense.
What are you trying to do?

Cheers,
_

robel
14th October 2015, 20:47
I want just to show scene ,
mywidget is class that view scen3d
11432
if i change the widget position like that

widget->setObjectName(QString::fromUtf8("widget"));
widget->setGeometry(QRect(50, 500, 211, 250));

i get this
11433
and i see the button just when i resize the window

anda_skoa
14th October 2015, 21:41
What do you need the widget "widget" for?

If you want the button to be on top of "mywidget", just use it as the parent.
Maybe even use a layout and spacers to move the button to where it should be.

Cheers,
_

robel
15th October 2015, 07:57
HI,
i want just to see the button in the bottom of the window
i tried to use mywidget as parent but i can't see the button (for that i added "widget")
can you give me an example how i add it in the button of the window?

anda_skoa
15th October 2015, 08:48
What type is Qmywidget derived from?

I would have tried somethng like this


QGridLayout *layout = new QGridLayout(mywidget);
QSpacerItem *verticalSpacer = new QSpacerItem(1, 1, QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
QSpacerItem *horizontalSpacer = new QSpacerItem(1, 1, QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
layout->addItem(verticalSpacer, 0, 0);
layout->addItem(horizontalSpacer, 1, 1);
layout->addWidget(anim, 1, 0);


Cheers,
_