本文整理汇总了C++中QStackedLayout::setStackingMode方法的典型用法代码示例。如果您正苦于以下问题:C++ QStackedLayout::setStackingMode方法的具体用法?C++ QStackedLayout::setStackingMode怎么用?C++ QStackedLayout::setStackingMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStackedLayout
的用法示例。
在下文中一共展示了QStackedLayout::setStackingMode方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pixmap
QHelpBox::QHelpBox(QWidget *_parent) : QWidget(_parent)
{
defaultMsg = "";
parent = _parent;
helpBox = new QLabel();
helpBox->setStyleSheet("border: 1px solid; border-color: rgb(71,127,249); background-color: rgb(245,245,245); margin-top:0px; "
"margin-bottom:0px; margin-left: 0px; padding-right: 4px; padding-top:2px; padding-bottom:2px; padding-left:60px; text-align:justify;"
"");
helpBox->setWordWrap(true);
QFont tinyFont = QApplication::font();
#if defined Q_OS_WIN
tinyFont.setPointSize(7);
#endif
helpBox->setFont(tinyFont);
QPixmap pixmap(":/icons/help.png");
helpIcon = new QLabel();
helpIcon->setPixmap(pixmap.scaled(35,35, Qt::KeepAspectRatio, Qt::SmoothTransformation));
helpIcon->setStyleSheet("margin-left: 10px");
QStackedLayout *helpLayout = new QStackedLayout();
helpLayout->addWidget(helpBox);
helpLayout->addWidget(helpIcon);
helpLayout->setStackingMode(QStackedLayout::StackAll);
setLayout(helpLayout);
}
示例2: QMainWindow
////public////
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent,Qt::FramelessWindowHint)
{
// this->setAutoFillBackground(true);
// QPalette palette;
// QPixmap pixmap(":/images/dialogbackground.jpg");
// palette.setBrush(QPalette::Window, QBrush(pixmap));
// this->setPalette(palette);
this->setWindowIcon(QIcon(":./iamges/window.icon"));
this->setAttribute(Qt::WA_TranslucentBackground);
arcR=10;
centralwidget=new CentralWidget(this);
play_label=new PlayLabel(centralwidget);
player = new SimPlayer;
contralwidget=new ContralWidget(this,player);
// contralwidget->setMainWindow(this);
play_label->setPlayer(player);
//////////////////////////////////////////////////布局
// this->setCentralWidget(centralwidget);
QStackedLayout *stack =new QStackedLayout;
stack->setStackingMode(QStackedLayout::StackAll);
stack->addWidget(play_label);
stack->addWidget(contralwidget);
// play_label->show();
centralwidget->setLayout(stack);
this->setGeometry(100,100,760,460);
BaseSetting::readSettings();
centralwidget->setGeometry(0,0,this->width()-15,this->height()-15);
HideSDLWindow(); //先设置好这个,再创建线程
connect(player,SIGNAL(display()),play_label,SLOT(display()));
}
示例3: QWidget
Speed::Speed(QWidget *parent): QWidget(parent)
{
QHBoxLayout *layout = new QHBoxLayout();
layout->setSpacing(0);
layout->setMargin(0);
setStyleSheet("padding: 0;");
QVBoxLayout *contentLayout = new QVBoxLayout();
contentLayout->setSpacing(2);
contentLayout->setMargin(0);
contentLayout->setContentsMargins(0, 2, 0, 0);
QWidget *content = new QWidget();
content->setLayout(contentLayout);
content->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
QStackedLayout *speedometerLayout = new QStackedLayout(contentLayout);
speedometerLayout->setSpacing(2);
speedometerLayout->setMargin(0);
speedometerLayout->setContentsMargins(0, 2, 0, 0);
speedometerLayout->setStackingMode(QStackedLayout::StackAll);
speedometerNeedle = new RotatableImageView(":/resources/speedometer-needle_160x160.png");
speedometerNeedle->rotate(-129);
speedometerLayout->addWidget(speedometerNeedle);
QLabel *speedometer = new QLabel();
speedometer->setPixmap(QPixmap(":/resources/speedometer_160x160.png"));
speedometer->setMargin(2);
speedometerLayout->addWidget(speedometer);
speedometerLabel = new QLabel("N/A");
speedometerLabel->setAlignment(Qt::AlignCenter);
speedometerLabel->setStyleSheet("font: 13pt; font-weight: bold;");
contentLayout->addWidget(speedometerLabel);
TitledBox *box = new TitledBox(tr("Speed"), content);
layout->addWidget(box);
QGraphicsDropShadowEffect *dropShadow = new QGraphicsDropShadowEffect();
dropShadow->setBlurRadius(6);
dropShadow->setColor(QColor(0, 0, 0));
dropShadow->setOffset(0, 0);
setGraphicsEffect(dropShadow);
setLayout(layout);
}
示例4: pixmap
QHelpBox::QHelpBox(QWidget *_parent) : QWidget(_parent)
{
parent = _parent;
backgroundPanel = new QLabel();
backgroundPanel->setStyleSheet("border: 1px solid; border-color: rgb(71,127,249); background-color: rgb(245,245,245); margin-top:0px; "
"margin-bottom:0px; margin-left: 0px; padding-right: 4px; padding-top:4px; padding-bottom:4px; padding-left:60px;"
"");
helpBox = new QLabel();
#ifdef Q_OS_LINUX
QFont tinyFont = QApplication::font();
tinyFont.setPointSize(9);
helpBox->setFont(tinyFont);
#endif
helpBox->setStyleSheet("margin-top:0px; margin-bottom:0px; margin-left: 0px; padding-right: 4px; padding-top:4px; padding-bottom:4px; padding-left:60px; text-align:justify;");
helpBox->setWordWrap(true);
helpBox->setTextFormat(Qt::RichText);
helpBox->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
helpBox->setOpenExternalLinks(true);
QPixmap pixmap(":/icons/help2.png");
helpIcon = new QLabel();
helpIcon->setPixmap(pixmap.scaled(50,50, Qt::KeepAspectRatio, Qt::SmoothTransformation));
helpIcon->setStyleSheet("margin-left: 5px");
QStackedLayout *helpLayout = new QStackedLayout();
helpLayout->addWidget(backgroundPanel);
helpLayout->addWidget(helpIcon);
helpLayout->addWidget(helpBox);
helpLayout->setStackingMode(QStackedLayout::StackAll);
setLayout(helpLayout);
#ifdef Q_OS_MAC
this->setFixedHeight(90);
#endif
#ifdef Q_OS_WIN32
this->setFixedHeight(120);
#endif
#ifdef Q_OS_LINUX
this->setFixedHeight(120);
#endif
}
示例5: image
void
MainWindow::useNewUI()
{
#if (QT_VERSION >= 0x040400)
QVBoxLayout *mainLayout;
QStackedLayout *logoLayout;
QGridLayout *bottomLayout;
QHBoxLayout *pathSizeLayout;
QPushButton *writeButton;
// Set the background colour
QPalette pal = palette();
pal.setColor(QPalette::Window, Qt::white);
setPalette(pal);
imageLabel = new CustomLabel(this);
imageLabel->setBackgroundRole(QPalette::Base);
imageLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
imageLabel->setScaledContents(false);
QImage image(":logo-empty.png");
imageLabel->setPixmap(QPixmap::fromImage(image));
imageLabel->setAlignment(Qt::AlignCenter);
directive = new CustomLabel(this);
directive->setText(tr("Drag disk image here\n or click to select."));
directive->setAlignment(Qt::AlignCenter);
deviceComboBox = new QComboBox;
deviceComboBox->addItem(DROPDOWN_DIRECTIVE);
writeButton = new QPushButton(tr("Write"));
connect(writeButton, SIGNAL(clicked()), this, SLOT(write()));
// These layouts are kind of a mess
logoLayout = new QStackedLayout;
logoLayout->setStackingMode(QStackedLayout::StackAll);
logoLayout->addWidget(directive);
logoLayout->addWidget(imageLabel);
pathSizeLayout = new QHBoxLayout;
pathSizeLayout->addWidget(fileLabel, Qt::AlignLeft);
pathSizeLayout->addWidget(fileSize, Qt::AlignLeft);
bottomLayout = new QGridLayout;
bottomLayout->addLayout(pathSizeLayout, 0, 0);
mainLayout = new QVBoxLayout;
AboutLabel *aboutLabel = new AboutLabel();
aboutLabel->setText("<u>About</u>");
mainLayout->addWidget(aboutLabel,0,Qt::AlignTop|Qt::AlignLeft);
mainLayout->addLayout(logoLayout, Qt::AlignHCenter);
QGridLayout *comboLayout = new QGridLayout;
comboLayout->addLayout(bottomLayout, 0, 0, Qt::AlignBottom);
comboLayout->addWidget(deviceComboBox, 1,0);
comboLayout->addWidget(writeButton, 1, 1, Qt::AlignRight);
mainLayout->addLayout(comboLayout);
setLayout(mainLayout);
if (!mMaximized)
resize(600, 400);
setAcceptDrops(true);
#endif
return;
}
示例6: 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*)));
//.........这里部分代码省略.........