本文整理汇总了C++中QSplitter::setChildrenCollapsible方法的典型用法代码示例。如果您正苦于以下问题:C++ QSplitter::setChildrenCollapsible方法的具体用法?C++ QSplitter::setChildrenCollapsible怎么用?C++ QSplitter::setChildrenCollapsible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSplitter
的用法示例。
在下文中一共展示了QSplitter::setChildrenCollapsible方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
RawEditorWidget::RawEditorWidget(QWidget * par)
: QWidget(par)
{
setObjectName("raw_event_editor");
QGridLayout * l = new QGridLayout(this);
QSplitter * spl = new QSplitter(Qt::Horizontal,this);
spl->setObjectName("raweditor_splitter");
spl->setChildrenCollapsible(false);
l->addWidget(spl,0,0);
KviTalVBox * boxi = new KviTalVBox(spl);
boxi->setMaximumWidth(200);
m_pTreeWidget = new RawTreeWidget(boxi);
m_pTreeWidget->setColumnCount(1);
m_pTreeWidget->setHeaderLabel(__tr2qs_ctx("Raw Event","editor"));
// m_pTreeWidget->setMultiSelection(false);
m_pTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
// m_pTreeWidget->setShowSortIndicator(true);
m_pTreeWidget->setRootIsDecorated(true);
m_pContextPopup = new QMenu(this);
m_pTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_pTreeWidget,SIGNAL(currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)),this,SLOT(currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)));
connect(m_pTreeWidget,SIGNAL(customContextMenuRequested(const QPoint &)),this,SLOT(customContextMenuRequested(const QPoint &)));
QPushButton * pb = new QPushButton(__tr2qs_ctx("&Export All To...","editor"),boxi);
connect(pb,SIGNAL(clicked()),this,SLOT(exportAllEvents()));
KviTalVBox * box = new KviTalVBox(spl);
m_pNameEditor = new QLineEdit(box);
m_pNameEditor->setToolTip(__tr2qs_ctx("Edit the raw event handler name.","editor"));
m_pEditor = KviScriptEditor::createInstance(box);
m_bOneTimeSetupDone = false;
m_pLastEditedItem = 0;
}
示例2: QWidget
ChatPageWidget::ChatPageWidget(int friendId, QWidget* parent) :
QWidget(parent), friendId(friendId)
{
friendItem = new FriendItemWidget(this);
display = new MessageDisplayWidget(this);
input = new InputTextWidget(this);
connect(input, &InputTextWidget::sendMessage, this, &ChatPageWidget::sendMessage);
connect(input, &InputTextWidget::sendAction, this, &ChatPageWidget::sendAction);
// Create emoticon menu :)
CustomHintWidget *inputPanel = new CustomHintWidget(this, QSize(10, 10));
EmoticonMenu *menu = new EmoticonMenu(this);
emoticonButton = new QToolButton(inputPanel);
emoticonButton->setPopupMode(QToolButton::InstantPopup);
emoticonButton->setIcon(QIcon(":/icons/emoticons/emotion_smile.png"));
emoticonButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
emoticonButton->setMenu(menu);
connect(menu, &EmoticonMenu::insertEmoticon, input, &InputTextWidget::insertHtml);
QHBoxLayout *inputLayout = new QHBoxLayout(inputPanel);
inputLayout->setContentsMargins(0,0,0,0);
inputLayout->setSpacing(2);
inputLayout->addWidget(input);
inputLayout->addWidget(emoticonButton);
QSplitter* splitter = new QSplitter(this);
splitter->setOrientation(Qt::Vertical);
splitter->setChildrenCollapsible(false);
splitter->addWidget(display);
splitter->addWidget(inputPanel);
splitter->setStretchFactor(0, 3);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(friendItem);
layout->addWidget(splitter);
layout->setSpacing(2);
layout->setContentsMargins(0, 0, 2, 3);
}
示例3: QWidget
QDatabaseConnectionView::QDatabaseConnectionView(QWidget* parent)
: QWidget(parent)
{
QVBoxLayout* pMainLayout = new QVBoxLayout();
setLayout(pMainLayout);
// Splitter
QSplitter *pSplitter = new QSplitter();
pSplitter->setChildrenCollapsible(false);
pMainLayout->addWidget(pSplitter);
// Create left panel
QWidget* pVertConnectionPanel = makeConnectionVerticalPanel(pSplitter);
pVertConnectionPanel->setMaximumWidth(300);
pSplitter->addWidget(pVertConnectionPanel);
// Create left panel
m_pTabsInConnection = new QMidClickClosableTabWidget(); //Used to create a tab widget in the opened connection tab
m_pTabsInConnection->setTabsClosable(true);
m_pTabsInConnection->setMovable(true);
pSplitter->addWidget(m_pTabsInConnection);
}
示例4: QMainWindow
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
setWindowTitle("MathML Browser");
QSplitter *splitter = new QSplitter(this);
splitter->setChildrenCollapsible(false);
m_file_browser = new FileBrowser("*.mml", splitter);
QWidget *formula_widget = new QWidget(splitter);
QVBoxLayout *layout = new QVBoxLayout;
layout->setSpacing(2);
layout->setMargin(2);
m_mml_widget = new QtMmlWidget(formula_widget);
layout->addWidget(m_mml_widget);
m_mml_widget->setBackgroundRole(QPalette::Base);
m_compare_image = new QLabel;
layout->addWidget(m_compare_image);
m_compare_image->setAlignment(Qt::AlignCenter);
m_compare_image->setBackgroundRole(QPalette::Base);
formula_widget->setLayout(layout);
setCentralWidget(splitter);
QToolBar *tool_bar = new QToolBar(this);
tool_bar->addAction(QIcon(":/images/zoom_in.png"),
"Zoom in", this, SLOT(zoomIn()));
tool_bar->addAction(QIcon(":/images/zoom_out.png"),
"Zoom out", this, SLOT(zoomOut()));
tool_bar->addAction(QIcon(":/images/frames.png"),
"Toggle frames", this, SLOT(toggleDrawFrames()));
addToolBar(tool_bar);
connect(m_file_browser, SIGNAL(fileSelected(const QString &)), this, SLOT(openFile(const QString &)));
}
示例5: QWidget
EventEditor::EventEditor(QWidget * par)
: QWidget(par)
{
setObjectName("event_editor");
QGridLayout * l = new QGridLayout(this);
QSplitter * spl = new QSplitter(Qt::Horizontal,this);
spl->setChildrenCollapsible(false);
l->addWidget(spl,0,0);
KviTalVBox * vbox = new KviTalVBox(spl);
vbox->setSpacing(0);
vbox->setMargin(0);
m_pTreeWidget = new EventEditorTreeWidget(vbox);
QPushButton * pb = new QPushButton(__tr2qs_ctx("&Export All To...","editor"),vbox);
connect(pb,SIGNAL(clicked()),this,SLOT(exportAllEvents()));
KviTalVBox * box = new KviTalVBox(spl);
spl->setStretchFactor (0,20);
spl->setStretchFactor (1,80);
box->setSpacing(0);
box->setMargin(0);
m_pNameEditor = new QLineEdit(box);
m_pNameEditor->setToolTip(__tr2qs_ctx("Edit the event handler name.","editor"));
m_pEditor = KviScriptEditor::createInstance(box);
m_pEditor->setFocus();
m_bOneTimeSetupDone = false;
m_pLastEditedItem = 0;
}
示例6: QWidget
PopupEditorWidget::PopupEditorWidget(QWidget * par)
: QWidget(par)
{
m_bSaving = false;
QGridLayout * l = new QGridLayout(this);
QSplitter * spl = new QSplitter(Qt::Horizontal, this);
spl->setObjectName("popupeditor_horizontal_splitter");
spl->setChildrenCollapsible(false);
l->addWidget(spl, 0, 0);
KviTalVBox * box = new KviTalVBox(spl);
m_pTreeWidget = new QTreeWidget(box);
m_pTreeWidget->setHeaderLabel(__tr2qs_ctx("Popup", "editor"));
m_pTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_pTreeWidget->header()->setSortIndicatorShown(true);
QPushButton * pb = new QPushButton(__tr2qs_ctx("&Export All to...", "editor"), box);
connect(pb, SIGNAL(clicked()), this, SLOT(exportAll()));
QPushButton * gn = new QPushButton(__tr2qs_ctx("&Export Selected to...", "editor"), box);
connect(gn, SIGNAL(clicked()), this, SLOT(exportSelected()));
m_pEditor = new SinglePopupEditor(spl);
m_bOneTimeSetupDone = false;
m_pLastEditedItem = nullptr;
m_pContextPopup = new QMenu(this);
m_pEmptyContextPopup = new QMenu(this);
spl->setStretchFactor(0, 20);
spl->setStretchFactor(1, 80);
currentItemChanged(nullptr, nullptr);
}
示例7: QWidget
ChatPageWidget::ChatPageWidget(const QString& userId, QWidget* parent) :
QWidget(parent), userId(userId)
{
friendItem = new FriendItemWidget(this);
display = new MessageDisplayWidget(this);
input = new InputTextWidget(this);
connect(input, &InputTextWidget::messageSent, this, &ChatPageWidget::messageSent);
connect(input, &InputTextWidget::messageSent, this, &ChatPageWidget::onMessageSent);
QSplitter* splitter = new QSplitter(this);
splitter->setOrientation(Qt::Vertical);
splitter->setChildrenCollapsible(false);
splitter->addWidget(display);
splitter->addWidget(input);
splitter->setStretchFactor(1, 3);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(friendItem);
layout->addWidget(splitter);
layout->setSpacing(2);
layout->setContentsMargins(0, 3, 2, 3);
}
示例8: QWidget
CPUWidget::CPUWidget(QWidget* parent) : QWidget(parent), ui(new Ui::CPUWidget)
{
ui->setupUi(this);
setDefaultDisposition();
mDisas = new CPUDisassembly(0);
mSideBar = new CPUSideBar(mDisas);
connect(mDisas, SIGNAL(tableOffsetChanged(int_t)), mSideBar, SLOT(changeTopmostAddress(int_t)));
connect(mDisas, SIGNAL(viewableRows(int)), mSideBar, SLOT(setViewableRows(int)));
connect(mDisas, SIGNAL(repainted()), mSideBar, SLOT(repaint()));
connect(mDisas, SIGNAL(selectionChanged(int_t)), mSideBar, SLOT(setSelection(int_t)));
connect(Bridge::getBridge(), SIGNAL(dbgStateChanged(DBGSTATE)), mSideBar, SLOT(debugStateChangedSlot(DBGSTATE)));
connect(Bridge::getBridge(), SIGNAL(updateSideBar()), mSideBar, SLOT(repaint()));
QSplitter* splitter = new QSplitter(this);
splitter->addWidget(mSideBar);
splitter->addWidget(mDisas);
splitter->setChildrenCollapsible(false);
splitter->setHandleWidth(1);
ui->mTopLeftUpperFrameLayout->addWidget(splitter);
mInfo = new CPUInfoBox();
ui->mTopLeftLowerFrameLayout->addWidget(mInfo);
int height = mInfo->getHeight();
ui->mTopLeftLowerFrame->setMinimumHeight(height + 2);
ui->mTopLeftLowerFrame->setMaximumHeight(height + 2);
connect(mDisas, SIGNAL(selectionChanged(int_t)), mInfo, SLOT(disasmSelectionChanged(int_t)));
mGeneralRegs = new RegistersView(0);
mGeneralRegs->setFixedWidth(1000);
mGeneralRegs->setFixedHeight(1400);
mGeneralRegs->ShowFPU(true);
QScrollArea* scrollArea = new QScrollArea;
scrollArea->setWidget(mGeneralRegs);
scrollArea->horizontalScrollBar()->setStyleSheet("QScrollBar:horizontal{border:1px solid grey;background:#f1f1f1;height:10px}QScrollBar::handle:horizontal{background:#aaa;min-width:20px;margin:1px}QScrollBar::add-line:horizontal,QScrollBar::sub-line:horizontal{width:0;height:0}");
scrollArea->verticalScrollBar()->setStyleSheet("QScrollBar:vertical{border:1px solid grey;background:#f1f1f1;width:10px}QScrollBar::handle:vertical{background:#aaa;min-height:20px;margin:1px}QScrollBar::add-line:vertical,QScrollBar::sub-line:vertical{width:0;height:0}");
QPushButton* button_changeview = new QPushButton("");
mGeneralRegs->SetChangeButton(button_changeview);
button_changeview->setStyleSheet("Text-align:left;padding: 4px;padding-left: 10px;");
QFont font = QFont("Lucida Console");
font.setStyleHint(QFont::Monospace);
font.setPointSize(8);
button_changeview->setFont(font);
connect(button_changeview, SIGNAL(clicked()), mGeneralRegs, SLOT(onChangeFPUViewAction()));
ui->mTopRightFrameLayout->addWidget(button_changeview);
ui->mTopRightFrameLayout->addWidget(scrollArea);
mDump = new CPUDump(mDisas, 0); //dump widget
ui->mBotLeftFrameLayout->addWidget(mDump);
mStack = new CPUStack(0); //stack widget
ui->mBotRightFrameLayout->addWidget(mStack);
}
示例9: QShortcut
OptionsDialog::OptionsDialog(QWidget * par,const QString &szGroup,bool bModal)
: QDialog(par)
{
setObjectName("general_options_dialog");
setWindowIcon(*(g_pIconManager->getSmallIcon(KviIconManager::KVIrc)));
m_szGroup = szGroup;
QString szDialogTitle;
if(szGroup.isEmpty() || KviQString::equalCI(szGroup,"general"))
{
szDialogTitle = __tr2qs_ctx("General Preferences","options");
} else if(KviQString::equalCI(szGroup,"theme"))
{
szDialogTitle = __tr2qs_ctx("Theme Preferences","options");
} else {
szDialogTitle = __tr2qs_ctx("KVIrc Preferences","options");
}
QString szDialog = __tr2qs_ctx("This dialog contains a set of KVIrc settings.<br> Use the icons " \
"on the left to navigate through the option pages. The text box in the " \
"bottom left corner is a small search engine. It will highlight the " \
"pages that contain options related to the search term you have entered.","options");
QString szInfoTips;
szInfoTips = __tr2qs_ctx("Many settings have tooltips that can be shown by holding " \
"the cursor over their label for a few seconds.","options");
QString szOkCancelButtons = __tr2qs_ctx("When you have finished, click \"<b>OK</b>\" to accept your changes " \
"or \"<b>Cancel</b>\" to discard them. Clicking \"<b>Apply</b>\" will commit your " \
"changes without closing the window.","options");
QString szFrontText = QString(
"<table width=\"100%\" height=\"100%\" valign=\"top\" align=\"center\" cellpadding=\"4\">" \
"<tr>" \
"<td bgcolor=\"#303030\" valign=\"top\">" \
"<center><h1><font color=\"#FFFFFF\">%1</font></h1></center>" \
"</td>" \
"</tr>" \
"<tr>" \
"<td valign=\"bottom\">" \
"<p>" \
"%2" \
"</p>" \
"<br style=\"line-height:5px;\"/>" \
"<p>" \
"%3" \
"</p>" \
"<br style=\"line-height:5px;\"/>" \
"<p>" \
"%4" \
"</p>" \
"</td>" \
"</tr>" \
"</table>"
).arg(szDialogTitle, szDialog, szInfoTips, szOkCancelButtons);
QString szCaption = szDialogTitle + " - KVIrc";
setWindowTitle(szCaption);
QGridLayout * g1 = new QGridLayout(this);
QSplitter * spl = new QSplitter(Qt::Horizontal,this);
spl->setChildrenCollapsible(false);
g1->addWidget(spl,0,0,1,5);
KviTalVBox * vbox = new KviTalVBox(spl);
vbox->setSpacing(2);
vbox->setMargin(3);
// Controlling list view
m_pTreeWidget = new QTreeWidget(vbox);
m_pTreeWidget->header()->hide();
m_pTreeWidget->setRootIsDecorated(true);
m_pTreeWidget->setSortingEnabled(false);
m_pTreeWidget->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::MinimumExpanding);
m_pTreeWidget->setCurrentItem(NULL);
connect(m_pTreeWidget,SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem *)),this,SLOT(treeWidgetItemSelectionChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
KviTalHBox * hbox = new KviTalHBox(vbox);
hbox->setSpacing(2);
hbox->setMargin(3);
m_pSearchLineEdit = new QLineEdit(hbox);
connect(m_pSearchLineEdit,SIGNAL(returnPressed()),this,SLOT(searchClicked()));
m_pSearchButton = new QToolButton(hbox);
m_pSearchButton->setIconSize(QSize(16,16));
m_pSearchButton->setIcon(*(g_pIconManager->getSmallIcon(KviIconManager::Search)));
connect(m_pSearchButton,SIGNAL(clicked()),this,SLOT(searchClicked()));
connect(m_pSearchLineEdit,SIGNAL(textChanged(const QString &)),this,SLOT(searchLineEditTextChanged(const QString &)));
QString szTip = __tr2qs_ctx("<p>This is the search tool for this options dialog.</p>" \
"<p>You can enter a search term either in your native " \
"language or in English and press the button on the right. " \
"The pages that contain some options related to the " \
//.........这里部分代码省略.........
示例10: 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());
}
示例11: 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);
}
示例12: QWidget
//.........这里部分代码省略.........
m_Shockview->setModel(m_ShocksModel);
for (int i = 2; i < numRatingBands + 2; i++)
m_Shockview->setItemDelegateForColumn(i,bpsDelegate);
for (int i = 0; i < numRatingBands+2; i++)
m_Shockview->hideColumn(i);
QVBoxLayout* mainLay = new QVBoxLayout(this);
QGridLayout* emailLay = new QGridLayout;
emailLay->addWidget(m_emailLabel, 0, 0);
emailLay->addWidget(m_emailEdit, 0, 1);
emailLay->addWidget(m_emailccLabel, 1, 0);
emailLay->addWidget(m_emailccEdit, 1, 1);
emailLay->addWidget(m_emailbccLabel, 2, 0);
emailLay->addWidget(m_emailbccEdit, 2, 1);
emailLay->addWidget(m_emailFromLabel, 3, 0);
emailLay->addWidget(m_emailFromEdit, 3, 1);
emailLay->addWidget(m_emailServerLabel, 4, 0);
emailLay->addWidget(m_emailServerEdit, 4, 1);
emailLay->addWidget(m_clientLabel, 5, 0);
emailLay->addWidget(m_clientEdit, 5, 1);
emailLay->addWidget(m_portfolioLabel, 6, 0);
emailLay->addWidget(m_portfolioEdit, 6, 1);
emailLay->addWidget(m_saveFolderLabel, 7, 0);
emailLay->addWidget(m_saveFolderEdit, 7, 1);
QSplitter* shockSplit = new QSplitter(this);
QWidget* LeftSplit = new QWidget(this);
QWidget* RightSplit = new QWidget(this);
QGridLayout* shocksLayRight = new QGridLayout(RightSplit);
QGridLayout* shocksLayLeft = new QGridLayout(LeftSplit);
shockSplit->addWidget(LeftSplit);
shockSplit->addWidget(RightSplit);
shockSplit->setStretchFactor(0, 1);
shockSplit->setStretchFactor(1, 2);
shockSplit->setChildrenCollapsible(false);
shockSplit->setOrientation(Qt::Horizontal);
shocksLayLeft->addWidget(m_scenarioList, 0, 1, 5, 3);
shocksLayLeft->addItem(new QSpacerItem(2, 2, QSizePolicy::Preferred, QSizePolicy::Expanding), 0, 0);
shocksLayLeft->addWidget(m_moveUpScenButton, 1, 0);
shocksLayLeft->addItem(new QSpacerItem(2, 2, QSizePolicy::Preferred, QSizePolicy::Expanding), 2, 0);
shocksLayLeft->addWidget(m_moveDownScenButton, 3, 0);
shocksLayLeft->addItem(new QSpacerItem(2, 2, QSizePolicy::Preferred, QSizePolicy::Expanding), 4, 0);
shocksLayLeft->addWidget(m_addScenarioButton, 5, 1);
shocksLayLeft->addWidget(m_copyScenarioButton, 5, 2);
shocksLayLeft->addWidget(m_removeScenarioButton, 5, 3);
shocksLayRight->addWidget(m_Shockview, 0, 0, 1, 2);
shocksLayRight->addWidget(m_addShockButton, 1, 0);
shocksLayRight->addWidget(m_removeShockButton, 1, 1);
mainLay->addLayout(emailLay);
mainLay->addWidget(shockSplit);
m_scenarioList->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
connect(m_scenarioList->selectionModel(), &QItemSelectionModel::currentChanged, [&](const QModelIndex& idx) ->void {
const bool idxValid = idx.isValid();
m_addShockButton->setEnabled(idxValid);
for (int i = 0; i < numRatingBands+2;i++){
idxValid ? m_Shockview->showColumn(i) : m_Shockview->hideColumn(i);
}
m_Shockview->setRootIndex(m_ShocksModel->index(idx.row(),0));
});
connect(m_addScenarioButton, &QPushButton::clicked, [this]()->void {
m_ShocksModel->insertRow(m_ShocksModel->rowCount());
m_ShocksModel->insertColumns(0, numRatingBands + 2, m_ShocksModel->index(m_ShocksModel->rowCount() - 1, 0));
m_ShocksModel->setData(m_ShocksModel->index(m_ShocksModel->rowCount() - 1, 0), tr("Scenario %1").arg(m_ShocksModel->rowCount()));
m_ShocksModel->setData(m_ShocksModel->index(m_ShocksModel->rowCount() - 1, 1), true, Qt::UserRole);
m_ShocksModel->setData(m_ShocksModel->index(m_ShocksModel->rowCount() - 1, 1), shockJumpDelegate->textForData(true));
});
示例13: loadConfig
/*!
\class LabelWidget
\brief Widget for editing the properties of a TextLabel object, mostly used in an appropriate dock widget.
In order the properties of the label to be shown, \c loadConfig() has to be called with the correspondig KConfigGroup
(settings for a label in *Plot, Axis etc. or for an independent label on the worksheet).
\ingroup kdefrontend
*/
LabelWidget::LabelWidget(QWidget* parent) : QWidget(parent),
m_label(0),
m_initializing(false),
m_dateTimeMenu(new QMenu(this)),
m_teXEnabled(false) {
// see legacy/LabelWidget.cpp
ui.setupUi(this);
QSplitter* splitter = new QSplitter(Qt::Vertical, this);
splitter->setHandleWidth(1);
splitter->addWidget(ui.frameTop);
splitter->addWidget(ui.frameBottom);
splitter->setChildrenCollapsible(false);
ui.lText->setMinimumWidth(ui.lGeometry->width());
this->layout()->addWidget(splitter);
m_dateTimeMenu->setSeparatorsCollapsible(false); //we don't want the first separator to be removed
ui.kcbFontColor->setColor(Qt::black); // default color
//Icons
ui.tbFontBold->setIcon( QIcon::fromTheme("format-text-bold") );
ui.tbFontItalic->setIcon( QIcon::fromTheme("format-text-italic") );
ui.tbFontUnderline->setIcon( QIcon::fromTheme("format-text-underline") );
ui.tbFontStrikeOut->setIcon( QIcon::fromTheme("format-text-strikethrough") );
ui.tbFontSuperScript->setIcon( QIcon::fromTheme("format-text-superscript") );
ui.tbFontSubScript->setIcon( QIcon::fromTheme("format-text-subscript") );
ui.tbSymbols->setIcon( QIcon::fromTheme("labplot-format-text-symbol") );
ui.tbDateTime->setIcon( QIcon::fromTheme("chronometer") );
ui.tbTexUsed->setIcon( QIcon::fromTheme("labplot-TeX-logo") );
//Positioning and alignment
ui.cbPositionX->addItem(i18n("left"));
ui.cbPositionX->addItem(i18n("center"));
ui.cbPositionX->addItem(i18n("right"));
ui.cbPositionX->addItem(i18n("custom"));
ui.cbPositionY->addItem(i18n("top"));
ui.cbPositionY->addItem(i18n("center"));
ui.cbPositionY->addItem(i18n("bottom"));
ui.cbPositionY->addItem(i18n("custom"));
ui.cbHorizontalAlignment->addItem(i18n("left"));
ui.cbHorizontalAlignment->addItem(i18n("center"));
ui.cbHorizontalAlignment->addItem(i18n("right"));
ui.cbVerticalAlignment->addItem(i18n("top"));
ui.cbVerticalAlignment->addItem(i18n("center"));
ui.cbVerticalAlignment->addItem(i18n("bottom"));
//check whether the used latex compiler is available.
//Following logic is implemented (s.a. LabelWidget::teXUsedChanged()):
//1. in case latex was used to generate the text label in the stored project
//and no latex is available on the target system, latex button is toggled and
//the user still can switch to the non-latex mode.
//2. in case the label was in the non-latex mode and no latex is available,
//deactivate the latex button so the user cannot switch to this mode.
m_teXEnabled = TeXRenderer::enabled();
#ifdef HAVE_KF5_SYNTAX_HIGHLIGHTING
m_highlighter = new KSyntaxHighlighting::SyntaxHighlighter(ui.teLabel->document());
m_highlighter->setDefinition(m_repository.definitionForName("LaTeX"));
#endif
//SLOTS
// text properties
connect(ui.tbTexUsed, SIGNAL(clicked(bool)), this, SLOT(teXUsedChanged(bool)) );
connect(ui.teLabel, SIGNAL(textChanged()), this, SLOT(textChanged()));
connect(ui.teLabel, SIGNAL(currentCharFormatChanged(QTextCharFormat)),
this, SLOT(charFormatChanged(QTextCharFormat)));
connect(ui.kcbFontColor, SIGNAL(changed(QColor)), this, SLOT(fontColorChanged(QColor)));
connect(ui.tbFontBold, SIGNAL(clicked(bool)), this, SLOT(fontBoldChanged(bool)));
connect(ui.tbFontItalic, SIGNAL(clicked(bool)), this, SLOT(fontItalicChanged(bool)));
connect(ui.tbFontUnderline, SIGNAL(clicked(bool)), this, SLOT(fontUnderlineChanged(bool)));
connect(ui.tbFontStrikeOut, SIGNAL(clicked(bool)), this, SLOT(fontStrikeOutChanged(bool)));
connect(ui.tbFontSuperScript, SIGNAL(clicked(bool)), this, SLOT(fontSuperScriptChanged(bool)));
connect(ui.tbFontSubScript, SIGNAL(clicked(bool)), this, SLOT(fontSubScriptChanged(bool)));
connect(ui.tbSymbols, SIGNAL(clicked(bool)), this, SLOT(charMenu()));
connect(ui.tbDateTime, SIGNAL(clicked(bool)), this, SLOT(dateTimeMenu()));
connect(m_dateTimeMenu, SIGNAL(triggered(QAction*)), this, SLOT(insertDateTime(QAction*)) );
connect(ui.kfontRequester, SIGNAL(fontSelected(QFont)), this, SLOT(fontChanged(QFont)));
connect(ui.kfontRequesterTeX, SIGNAL(fontSelected(QFont)), this, SLOT(teXFontChanged(QFont)));
connect(ui.sbFontSize, SIGNAL(valueChanged(int)), this, SLOT(fontSizeChanged(int)) );
// geometry
connect( ui.cbPositionX, SIGNAL(currentIndexChanged(int)), this, SLOT(positionXChanged(int)) );
connect( ui.cbPositionY, SIGNAL(currentIndexChanged(int)), this, SLOT(positionYChanged(int)) );
connect( ui.sbPositionX, SIGNAL(valueChanged(double)), this, SLOT(customPositionXChanged(double)) );
connect( ui.sbPositionY, SIGNAL(valueChanged(double)), this, SLOT(customPositionYChanged(double)) );
connect( ui.cbHorizontalAlignment, SIGNAL(currentIndexChanged(int)), this, SLOT(horizontalAlignmentChanged(int)) );
//.........这里部分代码省略.........
示例14: syntaxList
SyntaxEditorWindow::SyntaxEditorWindow(const QSharedPointer<SyntaxList> &syntaxList, const QString &syntaxName,
const QString &category, const QString &syntaxHint, QWidget *parent) :
QWidget(parent), syntaxList(syntaxList), syntaxName(syntaxName)
{
setWindowRole("kadu-syntax-editor");
setWindowTitle(tr("Kadu syntax editor"));
setAttribute(Qt::WA_DeleteOnClose);
QVBoxLayout *layout = new QVBoxLayout(this);
QSplitter *splitter = new QSplitter(this);
layout->addWidget(splitter);
splitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
splitter->setChildrenCollapsible(false);
QWidget *splitterleft = new QWidget(splitter);
QVBoxLayout *splitterleftlayout = new QVBoxLayout(splitterleft);
splitterleftlayout->setMargin(0);
splitterleftlayout->setSpacing(5);
editor = new QTextEdit(this);
splitterleftlayout->addWidget(editor);
editor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
editor->setAcceptRichText(true);
editor->setPlainText(syntaxList->readSyntax(syntaxName));
QFont font = this->font();
font.setFamily("monospace");
if(font.pixelSize() == -1)
font.setPointSizeF(font.pointSizeF() - 0.5);
else
font.setPixelSize(font.pixelSize() - 2);
editor->setFont(font);
editor->setMinimumSize(EDITOR_MINIMUM_SIZE);
if (!syntaxHint.isEmpty())
{
QLabel *editorhint = new QLabel(this);
splitterleftlayout->addWidget(editorhint);
editorhint->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
editorhint->setWordWrap(true);
editorhint->setText(syntaxHint);
}
QWidget *splitterright = new QWidget(splitter);
QVBoxLayout *splitterrightlayout = new QVBoxLayout(splitterright);
splitterrightlayout->setMargin(0);
splitterrightlayout->setSpacing(5);
previewPanel = new Preview(this);
splitterrightlayout->addWidget(previewPanel);
previewPanel->setMinimumHeight(0);
previewPanel->setMaximumHeight(QWIDGETSIZE_MAX);
previewPanel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
previewPanel->setResetBackgroundColor(config_file.readEntry("Look", category + "BgColor"));
previewPanel->setMinimumSize(PREVIEW_MINIMUM_SIZE);
QPushButton *previewbutton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_BrowserReload), tr("Refresh Preview"), this);
splitterrightlayout->addWidget(previewbutton);
connect(previewbutton, SIGNAL(clicked()), this, SLOT(refreshPreview()));
QDialogButtonBox *buttonslayout = new QDialogButtonBox(Qt::Horizontal, this);
layout->addWidget(buttonslayout);
QPushButton *saveSyntax = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogOkButton), tr("Save"), this);
QPushButton *saveAsSyntax = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogSaveButton), tr("Save as..."), this);
QPushButton *cancel = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton), tr("Cancel"), this);
buttonslayout->addButton(saveSyntax, QDialogButtonBox::YesRole);
buttonslayout->addButton(saveAsSyntax, QDialogButtonBox::ActionRole);
buttonslayout->addButton(cancel, QDialogButtonBox::RejectRole);
splitter->setSizes( QList<int>() << splitter->sizeHint().width() << 1 );
if (syntaxList->isGlobal(syntaxName))
saveSyntax->setDisabled(true);
else
connect(saveSyntax, SIGNAL(clicked()), this, SLOT(save()));
connect(saveAsSyntax, SIGNAL(clicked()), this, SLOT(saveAs()));
connect(cancel, SIGNAL(clicked()), this, SLOT(close()));
loadWindowGeometry(this, "Look", "SyntaxEditorGeometry", 0, 50, 790, 480);
}
示例15: 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();
}