tabWidget->setGeometry(0,15,650,400);
tabWidget->setStyleSheet("*{background-color:green;}");
for(int i=0; i<8;i++){
tabWidget->addTab(myfunction(),tr("Profile").append(name));
}
connect(Modelcombo,SIGNAL(currentIndexChanged(int)),this,SLOT(stCurrentIndex(int)));
connect(colorModecombo,SIGNAL(currentIndexChanged(int)),this,SLOT(stCurrentIndex(int)));
}
/*The function is */
page->setGeometry(0,25,650,500);
Modelab->setGeometry(0,60,120,20);
ModelcombosetGeometry(200,60,100,20);
Modelcombo->setFocusPolicy(Qt::NoFocus);
Modelcombo->addItem(tr("Normal"));
Modelcombo->addItem(tr("Bad"));
Modelcombo->addItem(tr("Good"));
colorModelab->setGeometry(0,100,80,20);
colorModecombo->setGeometry(200,100,100,20);
colorModecombo->setFocusPolicy(Qt::NoFocus);
colorModecombo->addItem(tr("Red"));
colorModecombo->addItem(tr("Blue"));
colorModecombo->addItem(tr("Green"));
return page;
}
/*the Slot is*/
void Widget::stCurrentIndex(int val){
qDebug()<< "Tab value is" << tabWidget->currentIndex();
qDebug()<< "Modle mode is" << Modelcombo->currentText();
qDebug()<< "Color is" << colorModecombo->currentText();
}
tabWidget = new QTabWidget(parent);
tabWidget->setGeometry(0,15,650,400);
tabWidget->setStyleSheet("*{background-color:green;}");
for(int i=0; i<8;i++){
QString name(QString::number(1));
tabWidget->addTab(myfunction(),tr("Profile").append(name));
}
connect(Modelcombo,SIGNAL(currentIndexChanged(int)),this,SLOT(stCurrentIndex(int)));
connect(colorModecombo,SIGNAL(currentIndexChanged(int)),this,SLOT(stCurrentIndex(int)));
}
/*The function is */
QWidget* Widget::myfunction(){
page = new QWidget();
page->setGeometry(0,25,650,500);
QLabel *Modelab = new QLabel(tr("Modle"),page);
Modelab->setGeometry(0,60,120,20);
Modelcombo = new QComboBox(page);
ModelcombosetGeometry(200,60,100,20);
Modelcombo->setFocusPolicy(Qt::NoFocus);
Modelcombo->addItem(tr("Normal"));
Modelcombo->addItem(tr("Bad"));
Modelcombo->addItem(tr("Good"));
QLabel *colorModelab = new QLabel(tr("Color"),page);
colorModelab->setGeometry(0,100,80,20);
colorModecombo = new QComboBox(page);
colorModecombo->setGeometry(200,100,100,20);
colorModecombo->setFocusPolicy(Qt::NoFocus);
colorModecombo->addItem(tr("Red"));
colorModecombo->addItem(tr("Blue"));
colorModecombo->addItem(tr("Green"));
return page;
}
/*the Slot is*/
void Widget::stCurrentIndex(int val){
qDebug()<< "Tab value is" << tabWidget->currentIndex();
qDebug()<< "Modle mode is" << Modelcombo->currentText();
qDebug()<< "Color is" << colorModecombo->currentText();
}
To copy to clipboard, switch view to plain text mode
Bookmarks