本文整理汇总了C++中QSplitter::setStyleSheet方法的典型用法代码示例。如果您正苦于以下问题:C++ QSplitter::setStyleSheet方法的具体用法?C++ QSplitter::setStyleSheet怎么用?C++ QSplitter::setStyleSheet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSplitter
的用法示例。
在下文中一共展示了QSplitter::setStyleSheet方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
QueryWidget::QueryWidget(IServerSPtr server, QWidget* parent)
: QWidget(parent)
{
shellWidget_ = new BaseShellWidget(server);
outputWidget_ = new OutputWidget(server);
VERIFY(connect(shellWidget_, &BaseShellWidget::rootCreated, outputWidget_, &OutputWidget::rootCreate));
VERIFY(connect(shellWidget_, &BaseShellWidget::rootCompleated, outputWidget_, &OutputWidget::rootCompleate));
VERIFY(connect(shellWidget_, &BaseShellWidget::addedChild, outputWidget_, &OutputWidget::addChild));
VERIFY(connect(shellWidget_, &BaseShellWidget::itemUpdated, outputWidget_, &OutputWidget::itemUpdate));
QSplitter* splitter = new QSplitter;
#ifdef OS_WIN
splitter->setStyleSheet("QSplitter::handle { background-color: gray }");
#endif
splitter->setOrientation(Qt::Vertical);
splitter->setHandleWidth(1);
QVBoxLayout *mainLayout = new QVBoxLayout;
splitter->addWidget(shellWidget_);
splitter->addWidget(outputWidget_);
splitter->setStretchFactor(0, 0);
splitter->setStretchFactor(1, 1);
mainLayout->addWidget(splitter);
setMinimumSize(QSize(min_width, min_height));
setLayout(mainLayout);
}
示例2: QWidget
QueryWidget::QueryWidget(core::IServerSPtr server, QWidget* parent)
: QWidget(parent), server_(server) {
shellWidget_ = new shell::BaseShellWidget(server);
outputWidget_ = new OutputWidget(server);
QSplitter* splitter = new QSplitter;
#ifdef OS_WIN
splitter->setStyleSheet("QSplitter::handle { background-color: gray }");
#endif
splitter->setOrientation(Qt::Vertical);
splitter->setHandleWidth(1);
QVBoxLayout* mainLayout = new QVBoxLayout;
splitter->addWidget(shellWidget_);
splitter->addWidget(outputWidget_);
splitter->setStretchFactor(0, 0);
splitter->setStretchFactor(1, 1);
mainLayout->addWidget(splitter);
setMinimumSize(QSize(min_width, min_height));
setLayout(mainLayout);
}
示例3: ready_msg
MainStatusBar::MainStatusBar(QWidget *parent) :
QStatusBar(parent),
cap_file_(NULL),
edit_action_(NULL),
delete_action_(NULL)
{
QSplitter *splitter = new QSplitter(this);
#ifdef HAVE_LIBPCAP
QString ready_msg(tr("Ready to load or capture"));
#else
QString ready_msg(tr("Ready to load file"));
#endif
QWidget *info_progress = new QWidget(this);
QHBoxLayout *info_progress_hb = new QHBoxLayout(info_progress);
QAction *action;
#if defined(Q_OS_WIN)
// Handles are the same color as widgets, at least on Windows 7.
splitter->setHandleWidth(3);
splitter->setStyleSheet(QString(
"QSplitter::handle {"
" border-left: 1px solid palette(mid);"
" border-right: 1px solid palette(mid);"
"}"
));
#elif defined(Q_OS_MAC)
expert_status_.setAttribute(Qt::WA_MacSmallSize, true);
#endif
expert_status_.setTextFormat(Qt::RichText);
expert_status_.hide();
// XXX Add the comment icon
info_progress_hb->setContentsMargins(0, 0, 0, 0);
info_status_.setTemporaryContext(STATUS_CTX_TEMPORARY);
info_progress_hb->addWidget(&expert_status_);
info_progress_hb->addWidget(&info_status_);
info_progress_hb->addWidget(&progress_bar_);
info_progress_hb->addStretch(10);
splitter->addWidget(info_progress);
splitter->addWidget(&packet_status_);
splitter->addWidget(&profile_status_);
splitter->setStretchFactor(0, 3);
splitter->setStretchFactor(1, 3);
splitter->setStretchFactor(2, 1);
addWidget(splitter, 1);
cur_main_status_bar_ = this;
splitter->hide();
info_status_.pushText(ready_msg, STATUS_CTX_MAIN);
packets_bar_update();
action = ctx_menu_.addAction(tr("Manage Profiles..."));
action->setData(ProfileDialog::ShowProfiles);
connect(action, SIGNAL(triggered()), this, SLOT(manageProfile()));
ctx_menu_.addSeparator();
action = ctx_menu_.addAction(tr("New..."));
action->setData(ProfileDialog::NewProfile);
connect(action, SIGNAL(triggered()), this, SLOT(manageProfile()));
edit_action_ = ctx_menu_.addAction(tr("Edit..."));
edit_action_->setData(ProfileDialog::EditCurrentProfile);
connect(edit_action_, SIGNAL(triggered()), this, SLOT(manageProfile()));
delete_action_ = ctx_menu_.addAction(tr("Delete"));
delete_action_->setData(ProfileDialog::DeleteCurrentProfile);
connect(delete_action_, SIGNAL(triggered()), this, SLOT(manageProfile()));
ctx_menu_.addSeparator();
profile_menu_.setTitle(tr("Switch to"));
ctx_menu_.addMenu(&profile_menu_);
connect(wsApp, SIGNAL(appInitialized()), splitter, SLOT(show()));
connect(wsApp, SIGNAL(appInitialized()), this, SLOT(pushProfileName()));
connect(&info_status_, SIGNAL(toggleTemporaryFlash(bool)),
this, SLOT(toggleBackground(bool)));
connect(wsApp, SIGNAL(captureCaptureUpdateContinue(capture_session*)),
this, SLOT(updateCaptureStatistics(capture_session*)));
connect(wsApp, SIGNAL(configurationProfileChanged(const gchar *)),
this, SLOT(pushProfileName()));
connect(&profile_status_, SIGNAL(mousePressedAt(QPoint,Qt::MouseButton)),
this, SLOT(showProfileMenu(QPoint,Qt::MouseButton)));
}
示例4: QWidget
MusicPage::MusicPage(QWidget *parent) : QWidget(parent)
{
this->setAttribute(Qt::WA_TranslucentBackground, true);//设置透明:窗体标题栏不透明,背景透明
QHBoxLayout *controlLayout = new QHBoxLayout;
addButton = new QPushButton("添加");
addButton->setFixedHeight(22);
controlLayout->addWidget(addButton);
controlLayout->setSpacing(1);
controlLayout->setMargin(0);
connect(addButton, SIGNAL(clicked(bool)), this, SIGNAL(addMusics()));
QWidget *controlBar = new QWidget;
controlBar->setStyleSheet("background:rgba(244,244,244,40%);");
//controlBar->setAttribute(Qt::WA_TranslucentBackground, true);
controlBar->setFixedHeight(22);
controlBar->setLayout(controlLayout);
QPushButton *addList = new QPushButton("+创建列表");
addList->setStyleSheet("background:rgba(244,244,244,40%);");
listList = new ListList;
connect(addList, SIGNAL(clicked(bool)), listList, SLOT(wantToCreateList()));
connect(listList, SIGNAL(tryToCreateList(QString)), this, SIGNAL(tryToCreateList(QString)));
connect(this, SIGNAL(createList(QString)), listList, SLOT(createList(QString)));
connect(this, SIGNAL(createList(QString)), this, SLOT(createList()));
connect(listList, SIGNAL(changeList(int)), this, SLOT(changeMusicList(int)));
connect(listList, SIGNAL(deleteList(QString)), this, SIGNAL(deleteList(QString)));
connect(listList, SIGNAL(deleteList(int)), this, SLOT(deleteList(int)));
QVBoxLayout *leftLayout = new QVBoxLayout;
leftLayout->addWidget(addList);
leftLayout->addWidget(listList);
leftLayout->setSpacing(1);
leftLayout->setMargin(0);
QWidget *leftWidget = new QWidget;
leftWidget->setLayout(leftLayout);
//leftWidget->setFixedWidth(80);
leftWidget->setMinimumWidth(80);
leftWidget->setMaximumWidth(120);
musicLists = new QStackedWidget;
musicLists->setMinimumWidth(80);
musicLists->setMaximumWidth(420);
QSplitter *splitter = new QSplitter(Qt::Horizontal, this);
splitter->setOpaqueResize(true);
splitter->setChildrenCollapsible(false);
splitter->addWidget(leftWidget);
splitter->addWidget(musicLists);
splitter->setStretchFactor(0, 2);
splitter->setStretchFactor(1, 5);
splitter->setStyleSheet("QSplitter::handle { background-color: rgba(0,0,0,0%) }");
splitter->setHandleWidth(1);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(controlBar);
//mainLayout->addLayout(midLayout);
mainLayout->addWidget(splitter);
mainLayout->setSpacing(1);
mainLayout->setMargin(1);
this->setLayout(mainLayout);
}
示例5: ready_msg
MainStatusBar::MainStatusBar(QWidget *parent) :
QStatusBar(parent),
cap_file_(NULL),
edit_action_(NULL),
delete_action_(NULL)
{
QSplitter *splitter = new QSplitter(this);
#ifdef HAVE_LIBPCAP
QString ready_msg(tr("Ready to load or capture"));
#else
QString ready_msg(tr("Ready to load file"));
#endif
QWidget *info_progress = new QWidget(this);
QHBoxLayout *info_progress_hb = new QHBoxLayout(info_progress);
QAction *action;
#if defined(Q_OS_WIN)
// Handles are the same color as widgets, at least on Windows 7.
splitter->setHandleWidth(3);
splitter->setStyleSheet(QString(
"QSplitter::handle {"
" border-left: 1px solid palette(mid);"
" border-right: 1px solid palette(mid);"
"}"
));
#endif
QString button_ss =
"QToolButton {"
" border: none;"
" background: transparent;" // Disables platform style on Windows.
" padding: 0px;"
" margin: 0px;"
"}";
expert_button_ = new QToolButton(this);
expert_button_->setIconSize(QSize(icon_size, icon_size));
expert_button_->setStyleSheet(button_ss);
expert_button_->hide();
// We just want a clickable image. Using a QPushButton or QToolButton would require
// a lot of adjustment.
StockIcon comment_icon("x-capture-comment-update");
comment_button_ = new QToolButton(this);
comment_button_->setIcon(comment_icon);
comment_button_->setIconSize(QSize(icon_size, icon_size));
comment_button_->setStyleSheet(button_ss);
comment_button_->setToolTip(tr("Open the Capture File Properties dialog"));
comment_button_->setEnabled(false);
connect(expert_button_, SIGNAL(clicked(bool)), this, SIGNAL(showExpertInfo()));
connect(comment_button_, SIGNAL(clicked(bool)), this, SIGNAL(editCaptureComment()));
info_progress_hb->setContentsMargins(icon_size / 2, 0, 0, 0);
info_status_.setTemporaryContext(STATUS_CTX_TEMPORARY);
info_status_.setShrinkable(true);
info_progress_hb->addWidget(expert_button_);
info_progress_hb->addWidget(comment_button_);
info_progress_hb->addWidget(&info_status_);
info_progress_hb->addWidget(&progress_frame_);
info_progress_hb->addStretch(10);
splitter->addWidget(info_progress);
splitter->addWidget(&packet_status_);
splitter->addWidget(&profile_status_);
splitter->setStretchFactor(0, 3);
splitter->setStretchFactor(1, 3);
splitter->setStretchFactor(2, 1);
addWidget(splitter, 1);
cur_main_status_bar_ = this;
splitter->hide();
info_status_.pushText(ready_msg, STATUS_CTX_MAIN);
packets_bar_update();
action = ctx_menu_.addAction(tr("Manage Profiles" UTF8_HORIZONTAL_ELLIPSIS));
action->setData(ProfileDialog::ShowProfiles);
connect(action, SIGNAL(triggered()), this, SLOT(manageProfile()));
ctx_menu_.addSeparator();
action = ctx_menu_.addAction(tr("New" UTF8_HORIZONTAL_ELLIPSIS));
action->setData(ProfileDialog::NewProfile);
connect(action, SIGNAL(triggered()), this, SLOT(manageProfile()));
edit_action_ = ctx_menu_.addAction(tr("Edit" UTF8_HORIZONTAL_ELLIPSIS));
edit_action_->setData(ProfileDialog::EditCurrentProfile);
connect(edit_action_, SIGNAL(triggered()), this, SLOT(manageProfile()));
delete_action_ = ctx_menu_.addAction(tr("Delete"));
delete_action_->setData(ProfileDialog::DeleteCurrentProfile);
connect(delete_action_, SIGNAL(triggered()), this, SLOT(manageProfile()));
ctx_menu_.addSeparator();
profile_menu_.setTitle(tr("Switch to"));
ctx_menu_.addMenu(&profile_menu_);
#ifdef QWINTASKBARPROGRESS_H
progress_frame_.enableTaskbarUpdates(true);
#endif
//.........这里部分代码省略.........
示例6: fileName
MainWindow::MainWindow(QFrame *parent)
: QFrame(parent),isLeftNaviVisuable(true)
{
setWindowFlags(Qt::FramelessWindowHint);
setMouseTracking(true);
setAttribute(Qt::WA_Hover, true);
QString fileName("/style/system.qss");
QFile file(fileName);
if (!file.open(QFile::ReadOnly)) {
file.setFileName(":/style/system.qss");
file.open(QFile::ReadOnly);
}
setStyleSheet(file.readAll());
file.close();
ptrHeaderBar = new HeaderBar(this);//创建标题栏
ptrStatusBar = new StatusBar(this);//创建状态栏
QString msg = "Ready";
ptrStatusBar->setMessage(msg);
lft = new LeftNavi(this);
lft->setFrameStyle(QFrame::NoFrame);
rgt = new QStackedWidget(this);
rgt->setObjectName("rgt");
rgt->setFrameStyle(QFrame::NoFrame);
NetPlanView *tpview = new NetPlanView();
rgt->addWidget(tpview);
NetResView *resview = new NetResView();
rgt->addWidget(resview);
QSplitter *mainSplitter = new QSplitter(this);
mainSplitter->setFrameStyle(QFrame::NoFrame);
mainSplitter->setHandleWidth(1);
mainSplitter->setStyleSheet(
QString("QSplitter::handle {background: qlineargradient("
"x1: 0, y1: 0, x2: 0, y2: 1,"
"stop: 0 %1, stop: 0.07 %2);}").
arg(qApp->palette().background().color().name()).
arg(qApp->palette().color(QPalette::Dark).name()));
mainSplitter->setChildrenCollapsible(false);
mainSplitter->addWidget(lft);
mainSplitter->addWidget(rgt);
mainSplitter->setStretchFactor(20,80);
createToolBarNull();
QHBoxLayout *ptrHLayout = new QHBoxLayout();
ptrHLayout->setMargin(0);
ptrHLayout->setSpacing(0);
ptrHLayout->addWidget(pushButtonNull_);
ptrHLayout->addWidget(mainSplitter);
QVBoxLayout *ptrVLayout = new QVBoxLayout();//创建布局
ptrVLayout->addWidget(ptrHeaderBar);//将部件加入到布局中
ptrVLayout->addLayout(ptrHLayout);
ptrVLayout->addWidget(ptrStatusBar);
ptrVLayout->setSpacing(0); //设置间距与边缘空白
ptrVLayout->setContentsMargins(VALUE_DIS,VALUE_DIS,VALUE_DIS,VALUE_DIS);
setLayout(ptrVLayout);
setMinimumWidth(800);
setMinimumHeight(600);
createActions();
FramelessHelper *pHelper = new FramelessHelper(this);
pHelper->activateOn(this); //激活当前窗体
pHelper->setBorderWidth(VALUE_DIS);
pHelper->setTitleHeight(HEADER_H); //设置窗体的标题栏高度
pHelper->setWidgetMovable(true); //设置窗体可移动
pHelper->setWidgetResizable(true); //设置窗体可缩放
connect(ptrHeaderBar, SIGNAL(signal_menu(QPoint)), this, SLOT(showMenu(QPoint)));
connect(ptrHeaderBar, SIGNAL(signal_maxrestore()), this, SLOT(showMaxRestore()));
//lft->setDatabase(db.db());
}
示例7: setupGUI
//.........这里部分代码省略.........
butZoomOut = new QToolButton(frameTools);
butZoomOut->setText("Out");
butZoomOut->setIcon(QIcon(QPixmap(":/icons/zoomOut.png")));
butZoomOut->setGeometry(5, 65, 20, 20);
butZoomOut->setToolTip("Zoom out");
butZoomOut->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
connect(butZoomOut, SIGNAL(clicked()), this, SLOT(butZoomOut_Clicked()));
butHand = new QToolButton(frameTools);
butHand->setText("Pan");
butHand->setIcon(QIcon(QPixmap(":/icons/hand.png")));
butHand->setGeometry(5, 95, 20, 20);
butHand->setToolTip("Pan");
butHand->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
butHand->setCheckable(true);
connect(butHand, SIGNAL(clicked()), this, SLOT(butHand_Clicked()));
butZoomWindow = new QToolButton(frameTools);
butZoomWindow->setText("Window");
butZoomWindow->setIcon(QIcon(QPixmap(":/icons/zoomWindow.png")));
butZoomWindow->setGeometry(5, 125, 20, 20);
butZoomWindow->setToolTip("Zoom window");
butZoomWindow->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
butZoomWindow->setCheckable(true);
connect(butZoomWindow, SIGNAL(clicked()), this, SLOT(butZoomWindow_Clicked()));
butZoomRestore = new QToolButton(frameTools);
butZoomRestore->setText("Restore");
butZoomRestore->setIcon(QIcon(QPixmap(":/icons/zoomRestore.png")));
butZoomRestore->setGeometry(5, 155, 20, 20);
butZoomRestore->setToolTip("Restore Zoom");
butZoomRestore->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
//butZoomRestore->setCheckable(true);
connect(butZoomRestore, SIGNAL(clicked()), this, SLOT(butZoomRestore_Clicked()));
zoomVec << 3200 << 2400 << 1600 << 1200 << 800 << 700 << 600 << 500 << 400 << 300
<< 200 << 100 << 66 << 50 << 33 << 25 << 16 << 12 << 8 << 5 << 3 << 2 << 1;
QStringList zoomList;
for (int i = 0; i < zoomVec.size(); i++)
zoomList.append( QString::number(zoomVec.at(i)) + "%");
zoomList.append(WINDOW);
zoomComboBox = new QComboBox(frameTools);
zoomComboBox->addItems(zoomList);
zoomComboBox->setGeometry(10, 95, 30, 20);
zoomComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
zoomComboBox->setCurrentIndex(23); // window //zoomIdx); //11);
//zoomComboBox->setCurrentIndex(zoomIdx); //11);
zoomComboBox->setEditable(true);
connect(zoomComboBox, SIGNAL(activated(const QString & )), this, SLOT(zoomActivated(const QString &)));
QHBoxLayout *hLayoutZoom1 = new QHBoxLayout();
hLayoutZoom1->setMargin(5);
QHBoxLayout *hLayoutZoom2 = new QHBoxLayout();
hLayoutZoom2->setMargin(5);
hLayoutZoom1->addWidget(butZoomIn);
hLayoutZoom1->addWidget(butZoomOut);
hLayoutZoom1->addWidget(butHand);
hLayoutZoom2->addWidget(butZoomWindow);
hLayoutZoom2->addWidget(butZoomRestore); // Exibe os layers de informação
treeLayers = new QTreeWidget(frameTools);
treeLayers->setGeometry(5, 150, 190, 310);
treeLayers->setHeaderLabel(tr("Layers"));
//lblOperator = new QLabel(tr("Operations: "), frameTools);
//lblOperator->setGeometry(10, 95, 150, 20);
QVBoxLayout *layoutTools = new QVBoxLayout(frameTools);
layoutTools->setMargin(5);
QSpacerItem *verticalSpacer = new QSpacerItem(20, 50, QSizePolicy::Minimum, QSizePolicy::Fixed);
layoutTools->addWidget(butLegend);
layoutTools->addItem(verticalSpacer);
layoutTools->addWidget(zoomComboBox);
layoutTools->addItem(hLayoutZoom1);
layoutTools->addItem(hLayoutZoom2);
// layoutTools->addWidget(lblOperator);
// layoutTools->addWidget(operatorComboBox);
layoutTools->addWidget(treeLayers);
QSplitter *splitter = new QSplitter(this);
splitter->setStyleSheet("QSplitter::handle{image: url(:/icons/splitter.png); QSplitter { width: 3px; }}");
splitter->addWidget(frameTools);
splitter->addWidget(view);
splitter->setStretchFactor(0, 0);
splitter->setStretchFactor(1, 1);
QHBoxLayout *layoutDefault = new QHBoxLayout(this);
layoutDefault->setMargin(5);
layoutDefault->addWidget(splitter);
setLayout(layoutDefault);
}
示例8: grBtoY
scannerwindow::scannerwindow(QList<int> parameters, QMainWindow *parent, bool load, QTextStream* stream):
QObject(parent)
{
this->parameters=parameters;
widget = new QWidget();
widget->setAttribute(Qt::WA_DeleteOnClose);
graph = new Q3DSurface();
container = QWidget::createWindowContainer(graph, widget);
container->setAttribute(Qt::WA_AcceptTouchEvents);
widget->setGeometry(
QStyle::alignedRect(
Qt::LeftToRight,
Qt::AlignTop,
widget->size(),
qApp->desktop()->availableGeometry()
)
);
bitmapForward=new QCustomPlot(widget);
bitmapBackward=new QCustomPlot(widget);
bitmapCombined=new QCustomPlot(widget);
bitmapForward->setContextMenuPolicy(Qt::CustomContextMenu);
bitmapBackward->setContextMenuPolicy(Qt::CustomContextMenu);
bitmapCombined->setContextMenuPolicy(Qt::CustomContextMenu);
bitmapBackward->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
bitmapForward->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
bitmapCombined->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
initializeBitmapForward(bitmapForward);
initializeBitmapBackward(bitmapBackward);
initializeBitmapCombined(bitmapCombined);
if (!graph->hasContext()) {
QMessageBox msgBox;
msgBox.setText("Couldn't initialize the OpenGL context.");
msgBox.exec();
}
QSize screenSize = graph->screen()->size();
container->setMinimumSize(QSize(screenSize.width() / 3, screenSize.height()/4));
container->setMaximumSize(screenSize);
container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
container->setFocusPolicy(Qt::StrongFocus);
bitmapBackward->setMinimumSize(screenSize.width()/4, screenSize.height()/4);
bitmapForward->setMinimumSize(screenSize.width()/4, screenSize.height()/4);
bitmapCombined->setMinimumSize(screenSize.width()/4, screenSize.height()/4);
QHBoxLayout *hLayout = new QHBoxLayout(widget);
QVBoxLayout *vLayout = new QVBoxLayout();
QSplitter *hSplitterMain = new QSplitter();
QSplitter *vSplitterRight = new QSplitter();
hLayout->setSizeConstraint(QBoxLayout::SizeConstraint::SetMinimumSize);
vSplitterRight->addWidget(bitmapForward);
vSplitterRight->addWidget(bitmapBackward);
vSplitterRight->addWidget(bitmapCombined);
vSplitterRight->setOrientation(Qt::Orientation::Vertical);
vSplitterRight->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
hSplitterMain->setOrientation(Qt::Orientation::Horizontal);
hSplitterMain->addWidget(container);
hSplitterMain->addWidget(vSplitterRight);
hSplitterMain->setStyleSheet("QSplitter::handle {background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,stop:0 rgba(255, 255, 255, 0),stop:0.407273 rgba(200, 200, 200, 255),stop:0.4825 rgba(101, 104, 113, 235), stop:0.6 rgba(255, 255, 255, 0));}");
vSplitterRight->setStyleSheet("QSplitter::handle {background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,stop:0 rgba(255, 255, 255, 0),stop:0.407273 rgba(200, 200, 200, 255),stop:0.4825 rgba(101, 104, 113, 235), stop:0.6 rgba(255, 255, 255, 0));}");
hLayout->addWidget(hSplitterMain);
hLayout->addLayout(vLayout);
vLayout->setAlignment(Qt::AlignTop);
widget->setWindowTitle(QStringLiteral("AFM Scan"));
QGroupBox *modelGroupBox = new QGroupBox(QStringLiteral("Scan"));
if(!load){
AFM_Scan_3D_RB = new QPushButton(widget);
AFM_Scan_3D_RB->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
AFM_Scan_3D_RB->setText(QStringLiteral("Start Scan"));
AFM_Scan_3D_RB->setCheckable(true);
AFM_Scan_3D_RB->setChecked(false);
}
SaveSurface = new QPushButton(widget);
SaveSurface->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
SaveSurface->setText(QStringLiteral("Save Data"));
BitmapView = new QPushButton(widget);
BitmapView->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
//.........这里部分代码省略.........
示例9: MainWindow
MusicWindow::MusicWindow(QWidget *parent) : MainWindow(parent)
{
this->setWindowIcon(QIcon(":/images/icons/app_icon"));
systemTrayIcon = new MySystemTrayIcon(this);
connect(systemTrayIcon, SIGNAL(showWindow()), this, SLOT(show()));
connect(systemTrayIcon, SIGNAL(quit()), this, SLOT(close()));
player = new MyPlayer();
connect(player, SIGNAL(playerStateChanged(int)), this, SLOT(playerStateChanged(int)));
connect(player, SIGNAL(musicChanged(QString,int)), this, SLOT(musicChanged(QString,int)));
topBar = new TopBar(this);
connect(topBar, SIGNAL(setMinSize()), this, SLOT(showMinimized()));
connect(topBar, SIGNAL(setMaxSize()), this, SLOT(setMaxSize()));
connect(topBar, SIGNAL(closeWindow()), this, SLOT(hide()));
connect(topBar, SIGNAL(quit()), this, SLOT(close()));
connect(topBar, SIGNAL(setBackgroud(QString)), this, SLOT(setBackgroud(QString)));
connect(topBar, SIGNAL(aboutQtMusic()), this, SLOT(aboutQtMusic()));
fuctionPage = new QStackedWidget;
fuctionPage->setMinimumWidth(200);
lyricLabel = new LyricLabel(false, this);
connect(player, SIGNAL(positionChanged(qint64)), lyricLabel, SLOT(postionChanged(qint64)));
connect(lyricLabel, SIGNAL(changeTo(qint64)), player, SLOT(setPosition(qint64)));
networkPage = new NetworkPage();
QLabel *label2 = new QLabel("Network");
label2->setAlignment(Qt::AlignCenter);
QLabel *label3 = new QLabel("Download");
label3->setAlignment(Qt::AlignCenter);
fuctionPage->addWidget(lyricLabel);
fuctionPage->addWidget(networkPage);
fuctionPage->addWidget(label3);
fuctionPage->setCurrentIndex(0);
connect(topBar, SIGNAL(selectFuction(int)), fuctionPage, SLOT(setCurrentIndex(int)));
musicPage = new MusicPage;
musicPage->setMaximumWidth(500);
musicPage->setMinimumWidth(300);
connect(musicPage, SIGNAL(tryToCreateList(QString)), this, SLOT(tryToCreateList(QString)));
connect(musicPage, SIGNAL(deleteList(QString)), this, SLOT(deleteList(QString)));
connect(musicPage, SIGNAL(addMusics()), this, SLOT(addMusics()));
connect(musicPage, SIGNAL(play(QString,int)), player, SLOT(playTheMusic(QString,int)));
connect(musicPage, SIGNAL(removeTheMusic(QString,int)), this, SLOT(removeTheMusic(QString,int)));
connect(musicPage, SIGNAL(removeAllMusics(QString)), this, SLOT(removeAllMusics(QString)));
connect(musicPage, SIGNAL(moveMusic(QString,int,int)), this, SLOT(moveMusic(QString,int,int)));
bottomBar = new BottomBar(this);
connect(bottomBar, SIGNAL(setVoice(int)), player, SLOT(setVoice(int)));
connect(bottomBar, SIGNAL(setMode(int)), player, SLOT(setPlayMode(int)));
connect(bottomBar, SIGNAL(setPostion(qint64)), player, SLOT(setPosition(qint64)));
connect(bottomBar, SIGNAL(setPostion(qint64)), lyricLabel, SLOT(setPostion(qint64)));
connect(player, SIGNAL(durationChanged(qint64)), bottomBar, SLOT(setMaxDuration(qint64)));
connect(player, SIGNAL(positionChanged(qint64)), bottomBar, SLOT(changePostionTo(qint64)));
connect(musicPage, SIGNAL(play(QString,int)), bottomBar, SLOT(setPostionAvailable()));
connect(bottomBar, SIGNAL(tryplay()), this, SLOT(clickPlay()));
connect(bottomBar, SIGNAL(playPre()), this, SLOT(playPre()));
connect(bottomBar, SIGNAL(playNext()), this, SLOT(playNext()));
connect(systemTrayIcon, SIGNAL(setMode(int)), bottomBar, SLOT(setPlayMode(int)));
connect(bottomBar, SIGNAL(setMode(int)), systemTrayIcon, SLOT(setPlayMode(int)));
connect(bottomBar, SIGNAL(showLyric(QString)), topBar, SLOT(changeFuction(QString)));
//connect(lyricLabel, SIGNAL(changeTo(qint64)), bottomBar, SLOT(changePostionTo(qint64)));
//connect(lyricLabel, SIGNAL(changeTo(qint64)), bottomBar, SIGNAL(setPostion(qint64)));
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(topBar);
QSplitter *splitter = new QSplitter(Qt::Horizontal, this);
//设定分割窗口的分割条在拖动时是否为实时更新 true为实时更新 false则在拖动时只显示一条灰色的线条
//在拖动到位并弹起鼠标后再显示分隔条
splitter->setOpaqueResize(false);
splitter->setChildrenCollapsible(false);
splitter->addWidget(fuctionPage);
splitter->addWidget(musicPage);
splitter->setStretchFactor(0, 10);
splitter->setStretchFactor(1, 1);
splitter->setStyleSheet("QSplitter::handle { background-color: rgba(0,0,0,0%) }");
splitter->setHandleWidth(4);
mainLayout->addWidget(splitter);
mainLayout->addWidget(bottomBar);
mainLayout->setMargin(1);
mainLayout->setSpacing(3);
this->setLayout(mainLayout);
dealMouse();
readData();
}