Qt-interest Archive, March 2002
QWidgetStack
Message 1 in thread
Hi,
I am trying to implement different buttongroups displayed on the GUI when
different item is selected from Popupmenu in the menubar.
I want to use QWidgetStack, but somehow cannot do it.
//Here I insert the item to popupmenu, and use SLOT to make the connection
format = new QPopupMenu( this );
m->insertItem("F&ormat", format );
format->insertItem( "Luminance", this, SLOT(doLuminanceButton()),
CTRL+Key_L );
//Here I defined the Stack
optionals = new QWidgetStack(hbox);
optionals_l = new QVBox(optionals);
optionals->addWidget(optionals_l,0);
// Here I make an exclusive button groups
group1 = new QButtonGroup(1, QGroupBox::Horizontal, "Luminance",
optionals_l);
//Here I define the radio button in that group
button_lum = new QRadioButton( "Luminance", m_l );
group1->hide();
//I define some more groups same way
....
// Put them in layout here
vlayout = new QVBoxLayout( this, 20, 20, "vlayout");
vlayout->setMenuBar( m );
vlayout->addWidget( hbox );
//In SLOT used above at beginning void ...::doLuminanceButton()
{
optionals->raiseWidget(0);
//I make sure that something visible checking to see if visibleWidget()
returns to 0-- The result is not 0, but INVISIBLE BUTTON GROUP!!!!
cout<<"\n HERE IS THE VISIBLE WIDGET:"<<optionals->visibleWidget()<<endl;
}
Why couldn't I see them though?!
Any help from previous experiences???
Thanks
PS> I tried to look at xform.cpp from examples for usage of QWidgetStack,
but didn't help.
Message 2 in thread
Ahmet Genc wrote:
> Hi,
>
> I am trying to implement different buttongroups displayed on the GUI when
> different item is selected from Popupmenu in the menubar.
>
> I want to use QWidgetStack, but somehow cannot do it.
>
> //Here I insert the item to popupmenu, and use SLOT to make the connection
>
> format = new QPopupMenu( this );
> m->insertItem("F&ormat", format );
> format->insertItem( "Luminance", this, SLOT(doLuminanceButton()),
> CTRL+Key_L );
>
> //Here I defined the Stack
> optionals = new QWidgetStack(hbox);
> optionals_l = new QVBox(optionals);
> optionals->addWidget(optionals_l,0);
>
> // Here I make an exclusive button groups
> group1 = new QButtonGroup(1, QGroupBox::Horizontal, "Luminance",
> optionals_l);
>
>
> //Here I define the radio button in that group
> button_lum = new QRadioButton( "Luminance", m_l );
>
> group1->hide();
>
> //I define some more groups same way
>
> ....
>
> // Put them in layout here
> vlayout = new QVBoxLayout( this, 20, 20, "vlayout");
> vlayout->setMenuBar( m );
> vlayout->addWidget( hbox );
>
> //In SLOT used above at beginning void ...::doLuminanceButton()
> {
>
> optionals->raiseWidget(0);
Better call here:
optionals->raiseWidget(optionals_l);
JK
>
>
> //I make sure that something visible checking to see if visibleWidget()
> returns to 0-- The result is not 0, but INVISIBLE BUTTON GROUP!!!!
> cout<<"\n HERE IS THE VISIBLE WIDGET:"<<optionals->visibleWidget()<<endl;
>
> }
>
> Why couldn't I see them though?!
>
> Any help from previous experiences???
>
> Thanks
>
> PS> I tried to look at xform.cpp from examples for usage of QWidgetStack,
> but didn't help.
>
> --
> List archive and information: http://qt-interest.trolltech.com
Message 3 in thread
It is over now.
I realised my fault -misused 'hide' option. Sorry.
Thanks
Genc
On Mon, 11 Mar 2002, Ahmet Genc wrote:
> Hi,
>
> I am trying to implement different buttongroups displayed on the GUI when
> different item is selected from Popupmenu in the menubar.
>
> I want to use QWidgetStack, but somehow cannot do it.
>
>
> //Here I insert the item to popupmenu, and use SLOT to make the connection
>
> format = new QPopupMenu( this );
> m->insertItem("F&ormat", format );
> format->insertItem( "Luminance", this, SLOT(doLuminanceButton()),
> CTRL+Key_L );
>
> //Here I defined the Stack
> optionals = new QWidgetStack(hbox);
> optionals_l = new QVBox(optionals);
> optionals->addWidget(optionals_l,0);
>
> // Here I make an exclusive button groups
> group1 = new QButtonGroup(1, QGroupBox::Horizontal, "Luminance",
> optionals_l);
>
>
> //Here I define the radio button in that group
> button_lum = new QRadioButton( "Luminance", m_l );
>
> group1->hide();
>
> //I define some more groups same way
>
> ....
>
> // Put them in layout here
> vlayout = new QVBoxLayout( this, 20, 20, "vlayout");
> vlayout->setMenuBar( m );
> vlayout->addWidget( hbox );
>
>
>
> //In SLOT used above at beginning void ...::doLuminanceButton()
> {
>
> optionals->raiseWidget(0);
>
> //I make sure that something visible checking to see if visibleWidget()
> returns to 0-- The result is not 0, but INVISIBLE BUTTON GROUP!!!!
> cout<<"\n HERE IS THE VISIBLE WIDGET:"<<optionals->visibleWidget()<<endl;
>
> }
>
>
>
> Why couldn't I see them though?!
>
> Any help from previous experiences???
>
>
> Thanks
>
> PS> I tried to look at xform.cpp from examples for usage of QWidgetStack,
> but didn't help.
>
> --
> List archive and information: http://qt-interest.trolltech.com
>