本文整理汇总了C++中QTabWidget::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ QTabWidget::clear方法的具体用法?C++ QTabWidget::clear怎么用?C++ QTabWidget::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTabWidget
的用法示例。
在下文中一共展示了QTabWidget::clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createMsgWindow
void SUiClient::createMsgWindow(QString ID, QString protoName)
{
SMsgWnd *messageWindow = new SMsgWnd();
connect(messageWindow, SIGNAL(debug(QString)), this, SIGNAL(debug(QString)));
messageWindow->Init(ID, protoName, 0);
registerUi(messageWindow);
connect(this, SIGNAL(windowCreated()), this, SLOT(showAllWindows()));
Ui::msgTabs msgTabs;
QWidget *tabWindow = new QWidget();
msgTabs.setupUi(tabWindow);
QTabWidget *tabs = tabWindow->findChild<QTabWidget *>("tabs");
if(!tabs)
emit debug("can't find tabs");
tabs->clear();
tabs->addTab(messageWindow->getUi(), "msg");
emit debug("tabs->count() == " + QString::number(tabs->count()));
emit createWidget(SMsgWndProto, messageWindow->protoWidg, protoName);
emit createWidget(SMsgWndUserInfo, messageWindow->userWidg, protoName);
// emit createWidget(SMsgBtns, messageWindow->msgWidg, protoName);
m_windows.append(tabWindow);
// emit windowCreated();
}
示例2: font
boost::shared_ptr<SettingsDialog::TopicDefinition> SettingsDialog::createTopic(const QString& topicname, const QString& iconpath)
{
shared_ptr<TopicDefinition> topic(getTopicDefinition(topicname));
if (topic.get() == 0)
{
topic = shared_ptr<TopicDefinition>(new TopicDefinition(topicname, 0, 0));
mTopicList.push_back(shared_ptr<TopicDefinition>(topic));
//Add new stacked widget page with a label and an empty tabwidget
QWidget* newWidget = new QWidget;
QVBoxLayout* newLayout = new QVBoxLayout;
QTabWidget* newTabWidget = new QTabWidget;
QLabel* newLabel = new QLabel(topicname);
QFont font(newLabel->font());
font.setPointSize(14);
newLabel->setFont(font);
newTabWidget->clear();
newLayout->setContentsMargins(0,0,0,0);
newLayout->addWidget(newLabel);
newLayout->addWidget(newTabWidget);
newWidget->setLayout(newLayout);
ui.stackedWidget->addWidget(newWidget);
//Add new entry in toolbox
NumberedToolButton* button = new NumberedToolButton(getStackedWidgetPageIndex(topicname));
if (iconpath.compare("") != 0)
button->setIcon(QIcon(iconpath));
else
button->setIcon(QIcon(":none"));
button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
button->setIconSize(QSize(30,30));
button->setText(topicname);
button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
ui.toolWidget->layout()->addWidget(button);
button->setAutoRaise(true);
topic->mTabWidget = newTabWidget;
topic->mStackedWidgetPage = newWidget;
topic->mNameLabel = newLabel;
topic->mButton = button;
topic->mIndex = button->mNumber;
//Clicking button emits index of the button
connect(button, SIGNAL(clicked(int)), this, SLOT(topicButtonClicked(int)));
//Changing the page or topic updates settings
connect(newTabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateCurrentSettings()));
}
示例3: clear
void QTabWidgetProto::clear()
{
QTabWidget *item = qscriptvalue_cast<QTabWidget*>(thisObject());
if (item)
item->clear();
}
示例4: drv_tabwidget
int drv_tabwidget(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9)
{
handle_head* head = (handle_head*)a0;
QTabWidget *self = (QTabWidget*)head->native;
switch (drvid) {
case TABWIDGET_INIT: {
drvNewObj(a0,new QTabWidget);
break;
}
case TABWIDGET_ADDTAB: {
self->addTab(drvGetWidget(a1),drvGetString(a2));
break;
}
case TABWIDGET_CLEAR: {
self->clear();
break;
}
case TABWIDGET_COUNT: {
drvSetInt(a1,self->count());
break;
}
case TABWIDGET_CURRENTINDEX: {
drvSetInt(a1,self->currentIndex());
break;
}
case TABWIDGET_CURRENTWIDGET: {
drvSetHandle(a1,self->currentWidget());
break;
}
case TABWIDGET_SETCURRENTINDEX: {
self->setCurrentIndex(drvGetInt(a1));
break;
}
case TABWIDGET_SETCURRENTWIDGET: {
self->setCurrentWidget(drvGetWidget(a1));
break;
}
case TABWIDGET_INDEXOF: {
drvSetInt(a2,self->indexOf(drvGetWidget(a1)));
break;
}
case TABWIDGET_INSERTTAB: {
self->insertTab(drvGetInt(a1),drvGetWidget(a2),drvGetString(a3));
break;
}
case TABWIDGET_REMOVETAB: {
self->removeTab(drvGetInt(a1));
break;
}
case TABWIDGET_SETTABTEXT: {
self->setTabText(drvGetInt(a1),drvGetString(a2));
break;
}
case TABWIDGET_SETTABTOOLTIP: {
self->setTabToolTip(drvGetInt(a1),drvGetString(a2));
break;
}
case TABWIDGET_TABTEXT: {
drvSetString(a2,self->tabText(drvGetInt(a1)));
break;
}
case TABWIDGET_TABTOOLTIP: {
drvSetString(a2,self->tabToolTip(drvGetInt(a1)));
break;
}
case TABWIDGET_WIDGETOF: {
drvSetHandle(a2,self->widget(drvGetInt(a1)));
break;
}
case TABWIDGET_ONCURRENTCHANGED: {
QObject::connect(self,SIGNAL(currentChanged(int)),drvNewSignal(self,a1,a2),SLOT(call(int)));
break;
}
default:
return 0;
}
return 1;
}