View Full Version : KDialog, tabs, get active tab pushbuttons, qradiobuttons
sang
26th August 2010, 08:13
Hei!
Small ui file -> contains QTabWidget
And cpp file I'm adding radiobuttons.
How to get active radiobuttons and something?
newTab is QWidget (QRadioButtons etc)
MyClass::MyClass( const QString &handle, const QString &name )
: KDialog()
, Ui::MyWindow()
{
.....
QVBoxLayout
QWidget
QRadioButtons
.....
newTab->setLayout( layout );
tabWidget->addTab( newTab, name );
.....
}
Lykurg
26th August 2010, 09:38
Loop through your radio buttons and check if they are selected. And you might want give KDialog a parent.
sang
27th August 2010, 07:53
Ok, how to get active tab's qradiobuttons? I call this class many times (and everytime opens new tab, wich contains radiobuttons etc).
sang
27th August 2010, 14:52
How to loop QRadioButtons?
tbscope
27th August 2010, 14:59
All your objects have names, use those to check each and every radio button.
myRadioButton->isChecked();
myRadioButton->setChecked(true or false);
Change myRadioButton with the name of another radio button etc...
Now, if you want to make it yourself a lot easier, create a list of radiobuttons.
QList<QRadioButton *> myRadioButtons;
QRadioButton *newRadioButton = new QRadioButton(this);
myRadioButtons.append(newRadioButton);
etc...
foreach(QRadioButton *button, myRadioButtons) {
if (button->isChecked()) {
// do something
}
}
sang
27th August 2010, 16:27
QList<QRadioButton *> aRadioButtons;
aOption_ = new QRadioButton( "&a Option:", this );
gList_ = new QListWidget( this );
alOption_ = new QRadioButton( "&b option", this );
bOption_ = new QRadioButton( "&c option", this );
aRadioButtons.append( aOption_ );
aRadioButtons.append( alOption_ );
aRadioButtons.append( bOption_ );
either way I can, too?
sang
27th August 2010, 17:10
I'm tring that:
QList<QRadioButton *> myList;
int index = 0;
if( myLits.at(index)->isChecked() )
{}
sang
2nd September 2010, 17:48
I have a problem, I have a window but I would like to be a new tab.
Dialog *dialog = new Dialog( param );
Dialog::Dialog( const QString& param, QWidget* parent )
: QWidget( parent )
, Ui::Dialog()
{
setupUi( this );
// Set up the label
QVBoxLayout
QWidget
QLabel
...... etc
QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
layout->addWidget( ... etc );
TabWidget->setLayout( layout );
tabWidget->addTab( TabWidget, "new tab" );
}
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.