本文整理汇总了C++中QSignalMapper::setObjectName方法的典型用法代码示例。如果您正苦于以下问题:C++ QSignalMapper::setObjectName方法的具体用法?C++ QSignalMapper::setObjectName怎么用?C++ QSignalMapper::setObjectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSignalMapper
的用法示例。
在下文中一共展示了QSignalMapper::setObjectName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createPluginHost
void RackWindow::createPluginHost(int position)
{
//layout settings widget:
QWidget *settingsWidget = new QWidget;
settingsWidget->setPalette(QPalette(QColor(0,0,0,160)));
settingsWidget->setAutoFillBackground(true);
RPushButton *leftButton = new RPushButton;
leftButton->setObjectName("rackSettingsLeftArrowButton");
RPushButton *rightButton = new RPushButton;
rightButton->setObjectName("rackSettingsRightArrowButton");
RPushButton *topButton = new RPushButton;
topButton->setObjectName("rackSettingsTopArrowButton");
RPushButton *bottomButton = new RPushButton;
bottomButton->setObjectName("rackSettingsBottomArrowButton");
RPushButton *closeButton = new RPushButton;
closeButton->setObjectName("rackSettingsCloseButton");
//vertical toolbar for plugin buttons:
QToolBar *pluginHostToolBar = new QToolBar;
pluginHostToolBar->setObjectName("rackPluginHostToolBar");
pluginHostToolBar->setOrientation(Qt::Vertical);
//actiongroup for exclusive handling of buttons:
QActionGroup *ag = new QActionGroup(pluginHostToolBar);
ag->setExclusive(true);
RPushButton *addPluginWidgetButton = new RPushButton(tr("Add Widget ..."));
addPluginWidgetButton->setObjectName("rackAddPluginWidgetButton");
QWidget *middleWidget = new QWidget;
QVBoxLayout *middleLayout = new QVBoxLayout(middleWidget);
middleLayout->setSpacing(0);
middleLayout->setContentsMargins(0,0,0,0);
middleLayout->addWidget(pluginHostToolBar, 0, Qt::AlignHCenter);
middleLayout->addWidget(addPluginWidgetButton, 0, Qt::AlignHCenter);
QGridLayout *settingsLayout = new QGridLayout(settingsWidget);
settingsLayout->setSpacing(0);
settingsLayout->setContentsMargins(0,0,0,0);
settingsLayout->addWidget(topButton,0,1, Qt::AlignTop | Qt::AlignHCenter);
settingsLayout->addWidget(closeButton,0,2, Qt::AlignTop | Qt::AlignRight);
settingsLayout->addWidget(leftButton,1,0, Qt::AlignLeft);
settingsLayout->addWidget(rightButton,1,2, Qt::AlignRight);
settingsLayout->addWidget(bottomButton,2,1, Qt::AlignBottom| Qt::AlignHCenter);
settingsLayout->addWidget(middleWidget,1,1);
QStackedWidget *pluginStack = new QStackedWidget;
pluginStack->setObjectName("rackPluginStack");
pluginStack->setAutoFillBackground(true);
QWidget *pluginHost = new QWidget;
pluginHost->setMinimumSize(200,80);
QStackedLayout *overlayLayout = new QStackedLayout(pluginHost);
overlayLayout->setStackingMode(QStackedLayout::StackAll);
overlayLayout->addWidget(pluginStack);
overlayLayout->addWidget(settingsWidget);
overlayLayout->setCurrentIndex(1);
//enter/leave settings signals:
QSignalMapper *mapperShowSettingsMode = new QSignalMapper(pluginHost);
QObject::connect(this, SIGNAL(enterSettingsMode()), mapperShowSettingsMode, SLOT(map()));
mapperShowSettingsMode->setMapping(this, 1);
QSignalMapper *mapperHideSettingsMode = new QSignalMapper(pluginHost);
QObject::connect(this, SIGNAL(leaveSettingsMode()), mapperHideSettingsMode, SLOT(map()));
mapperHideSettingsMode->setMapping(this, 0);
QObject::connect(mapperShowSettingsMode, SIGNAL(mapped(int)), overlayLayout, SLOT(setCurrentIndex(int)));
QObject::connect(mapperHideSettingsMode, SIGNAL(mapped(int)), overlayLayout, SLOT(setCurrentIndex(int)));
//create plugin host widget signals:
QSignalMapper *mapperCreatePluginHost = new QSignalMapper(pluginHost);
QObject::connect(leftButton, SIGNAL(clicked()), mapperCreatePluginHost, SLOT(map()));
QObject::connect(rightButton, SIGNAL(clicked()), mapperCreatePluginHost, SLOT(map()));
QObject::connect(topButton, SIGNAL(clicked()), mapperCreatePluginHost, SLOT(map()));
QObject::connect(bottomButton, SIGNAL(clicked()), mapperCreatePluginHost, SLOT(map()));
mapperCreatePluginHost->setMapping(leftButton, NewSplitterLeft);
mapperCreatePluginHost->setMapping(rightButton, NewSplitterRight);
mapperCreatePluginHost->setMapping(topButton, NewSplitterTop);
mapperCreatePluginHost->setMapping(bottomButton, NewSplitterBottom);
QObject::connect(mapperCreatePluginHost, SIGNAL(mapped(int)), SLOT(createPluginHost(int)));
//load plugin signal:
QObject::connect(addPluginWidgetButton, SIGNAL(clicked()), m_mapperLoadNewPlugin, SLOT(map()));
m_mapperLoadNewPlugin->setMapping(addPluginWidgetButton, pluginHost);
//close plugin host signal:
QObject::connect(closeButton, SIGNAL(clicked()), m_mapperClosePluginHost, SLOT(map()));
m_mapperClosePluginHost->setMapping(closeButton, pluginHost);
//create plugin switch signalmapper
QSignalMapper *mapperSwitchPlugin = new QSignalMapper(pluginHost);
mapperSwitchPlugin->setObjectName("rackPluginSwitchMapper");
QObject::connect(mapperSwitchPlugin, SIGNAL(mapped(QWidget *)), pluginStack, SLOT(setCurrentWidget(QWidget *)));
////test show/hide plugin widget
////QObject::connect(mapperSwitchPlugin, SIGNAL(mapped(QWidget *)), this, SLOT(showHidePluginWidget(QWidget*)));
//.........这里部分代码省略.........