本文整理汇总了C++中QSplitter::setContentsMargins方法的典型用法代码示例。如果您正苦于以下问题:C++ QSplitter::setContentsMargins方法的具体用法?C++ QSplitter::setContentsMargins怎么用?C++ QSplitter::setContentsMargins使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSplitter
的用法示例。
在下文中一共展示了QSplitter::setContentsMargins方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
QueryWidget::QueryWidget(IServerSPtr server, QWidget* parent)
: QWidget(parent)
{
shellWidget_ = new BaseShellWidget(server);
outputWidget_ = new OutputWidget(server.get());
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);
splitter->setContentsMargins(0, 0, 0, 0);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->setSpacing(0);
splitter->addWidget(shellWidget_);
splitter->addWidget(outputWidget_);
splitter->setStretchFactor(0, 0);
splitter->setStretchFactor(1, 1);
mainLayout->addWidget(splitter);
setLayout(mainLayout);
}
示例2: FWindowTab
FViewer3d::FViewer3d(QWidget *parent)
: FWindowTab(parent)
{
Chart3d = new FChart3d;
Chart3d->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
TableChart3d = new QTableWidget(this);
TableChart3d->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
TableChart3d->setSelectionMode(QAbstractItemView::SingleSelection);
CreateActions();
CreateToolBar();
QSplitter *Splitter = new QSplitter;
Splitter->setOrientation(Qt::Horizontal);
Splitter->setContentsMargins(0,0,0,0);
Splitter->addWidget(Chart3d);
Splitter->addWidget(TableChart3d);
QVBoxLayout *vertLayout = new QVBoxLayout;
vertLayout->setContentsMargins(0,0,0,0);
vertLayout->setSpacing(0);
vertLayout->addWidget(ToolBar);
vertLayout->addWidget(Splitter);
this->setLayout(vertLayout);
CreateConnections();
}
示例3: QDialog
EncodeDecodeDialog::EncodeDecodeDialog(QWidget* parent)
: QDialog(parent)
{
setWindowIcon(GuiFactory::instance().encodeDecodeIcon());
setWindowTitle(translations::trEncodeDecode);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QVBoxLayout* layout = new QVBoxLayout;
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
QPushButton* closeButton = buttonBox->button(QDialogButtonBox::Close);
buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
VERIFY(connect(buttonBox, &QDialogButtonBox::rejected, this, &EncodeDecodeDialog::reject));
QToolButton* decode = new QToolButton;
decode->setIcon(GuiFactory::instance().executeIcon());
VERIFY(connect(decode, &QToolButton::clicked, this, &EncodeDecodeDialog::decode));
decoders_ = new QComboBox;
for(int i = 0; i < SIZEOFMASS(common::EDecoderTypes); ++i) {
decoders_->addItem(common::convertFromString<QString>(common::EDecoderTypes[i]));
}
QHBoxLayout* toolBarLayout = new QHBoxLayout;
toolBarLayout->setContentsMargins(0, 0, 0, 0);
toolBarLayout->addWidget(decode);
toolBarLayout->addWidget(decoders_);
encodeButton_ = new QRadioButton;
decodeButton_ = new QRadioButton;
toolBarLayout->addWidget(encodeButton_);
toolBarLayout->addWidget(decodeButton_);
QSplitter* splitter = new QSplitter;
splitter->setOrientation(Qt::Horizontal);
splitter->setHandleWidth(1);
splitter->setContentsMargins(0, 0, 0, 0);
toolBarLayout->addWidget(splitter);
input_ = new FastoEditor;
input_->installEventFilter(this);
output_ = new FastoEditor;
output_->installEventFilter(this);
layout->addWidget(input_);
layout->addLayout(toolBarLayout);
layout->addWidget(output_);
layout->addWidget(buttonBox);
setMinimumSize(QSize(width, height));
setLayout(layout);
retranslateUi();
}
示例4: QFrame
SettingsWindow::SettingsWindow(QWidget *parent) :
QFrame(parent)
{
settings = new QSettings;
genCustomise();
genNavigation();
genInterface();
genBookmarks();
genSecurity();
genOptions();
genReset();
mainLayout = new QStackedWidget;
mainLayout->addWidget(tabCustomise);
mainLayout->addWidget(tabNavigation);
mainLayout->addWidget(tabInterface);
mainLayout->addWidget(tabBookmarks);
mainLayout->addWidget(tabSecurity);
mainLayout->addWidget(tabOptions);
mainLayout->addWidget(tabReset);
// connect(mainLayout,SIGNAL(currentChanged(int)),this,SLOT(indexChanged(int)));
tabBar = new TabList;
tabBar->setMinimumWidth(150);
tabBar->addTab(tabCustomise->title(),0);
tabBar->addTab(tabNavigation->title(),1);
tabBar->addTab(tabInterface->title(),2);
tabBar->addTab(tabBookmarks->title(),3);
tabBar->addTab(tabSecurity->title(),4);
/* tabBar->addTab(tabOptions->title(),5);
tabBar->addTab("Downloads",5);
tabBar->addTab("History",5);*/
tabBar->addTab(tabReset->title(),6);
connect(tabBar,SIGNAL(showTab(int)),mainLayout,SLOT(setCurrentIndex(int)));
QSplitter *layout = new QSplitter;
layout->setContentsMargins(0,0,0,0);
layout->addWidget(tabBar);
layout->addWidget(mainLayout);
QHBoxLayout *center = new QHBoxLayout;
center->setContentsMargins(0,0,0,0);
center->addWidget(layout);
setLayout(center);
btnClose = new QPushButton(QIcon(":/img/close.png"),"",this);
btnClose->setObjectName("TopBtn");
btnClose->setIconSize(QSize(20,20));
btnClose->move(this->geometry().width()-btnClose->geometry().width(),0);
connect(btnClose,SIGNAL(clicked()),this,SIGNAL(closeRequested()));
loadSettings();
}
示例5: void
ServerHistoryDialog::ServerHistoryDialog(const QString& title, connectionTypes type, QWidget* parent)
: QDialog(parent, Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint ), type_(type)
{
using namespace translations;
setWindowIcon(GuiFactory::instance().icon(type_));
setWindowTitle(title);
graphWidget_ = new fasto::qt::gui::GraphWidget;
settingsGraph_ = new QWidget;
QHBoxLayout *mainL = new QHBoxLayout;
QSplitter *splitter = new QSplitter;
splitter->setOrientation(Qt::Horizontal);
splitter->setHandleWidth(1);
splitter->setContentsMargins(0, 0, 0, 0);
mainL->addWidget(splitter);
splitter->addWidget(settingsGraph_);
serverInfoGroupsNames_ = new QComboBox;
serverInfoFields_ = new QComboBox;
typedef void (QComboBox::*curc)(int);
VERIFY(connect(serverInfoGroupsNames_, static_cast<curc>(&QComboBox::currentIndexChanged), this, &ServerHistoryDialog::refreshInfoFields ));
VERIFY(connect(serverInfoFields_, static_cast<curc>(&QComboBox::currentIndexChanged), this, &ServerHistoryDialog::refreshGraph ));
if(type_ == REDIS){
for(int i = 0; i < redisHeaders.size(); ++i){
serverInfoGroupsNames_->addItem(common::convertFromString<QString>(redisHeaders[i]));
}
}
else if(type_ == MEMCACHED){
for(int i = 0; i < memcachedHeaders.size(); ++i){
serverInfoGroupsNames_->addItem(common::convertFromString<QString>(memcachedHeaders[i]));
}
}
else if(type_ == SSDB){
for(int i = 0; i < SsdbHeaders.size(); ++i){
serverInfoGroupsNames_->addItem(common::convertFromString<QString>(SsdbHeaders[i]));
}
}
QVBoxLayout *setingsLayout = new QVBoxLayout;
setingsLayout->addWidget(serverInfoGroupsNames_);
setingsLayout->addWidget(serverInfoFields_);
settingsGraph_->setLayout(setingsLayout);
splitter->addWidget(graphWidget_);
setLayout(mainL);
glassWidget_ = new fasto::qt::gui::GlassWidget(GuiFactory::instance().pathToLoadingGif(), trLoading, 0.5, QColor(111, 111, 100), this);
}
示例6: QWidget
OutputWidget::OutputWidget(IServerSPtr server, QWidget* parent)
: QWidget(parent)
{
commonModel_ = new FastoCommonModel(this);
VERIFY(connect(commonModel_, &FastoCommonModel::changedValue, server.get(), &IServer::changeValue, Qt::DirectConnection));
VERIFY(connect(server.get(), &IServer::startedChangeDbValue, this, &OutputWidget::startChangeDbValue, Qt::DirectConnection));
VERIFY(connect(server.get(), &IServer::finishedChangeDbValue, this, &OutputWidget::finishChangeDbValue, Qt::DirectConnection));
treeView_ = new FastoTreeView;
treeView_->setModel(commonModel_);
tableView_ = new FastoTableView;
tableView_->setModel(commonModel_);
textView_ = new FastoTextView(server->outputDelemitr());
textView_->setModel(commonModel_);
textView_->setReadOnly(true);
timeLabel_ = new fasto::qt::gui::IconLabel(GuiFactory::instance().timeIcon(), "0", QSize(32, 32));
QVBoxLayout* mainL = new QVBoxLayout;
QHBoxLayout* topL = new QHBoxLayout;
QSplitter* splitter = new QSplitter;
splitter->setOrientation(Qt::Horizontal);
splitter->setHandleWidth(1);
splitter->setContentsMargins(0, 0, 0, 0);
treeButton_ = new QPushButton;
tableButton_ = new QPushButton;
textButton_ = new QPushButton;
treeButton_->setIcon(GuiFactory::instance().treeIcon());
VERIFY(connect(treeButton_, SIGNAL(clicked()), this, SLOT(setTreeView())));
tableButton_->setIcon(GuiFactory::instance().tableIcon());
VERIFY(connect(tableButton_, SIGNAL(clicked()), this, SLOT(setTableView())));
textButton_->setIcon(GuiFactory::instance().textIcon());
VERIFY(connect(textButton_, SIGNAL(clicked()), this, SLOT(setTextView())));
topL->addWidget(treeButton_);
topL->addWidget(tableButton_);
topL->addWidget(textButton_);
topL->addWidget(splitter);
topL->addWidget(timeLabel_);
mainL->addLayout(topL);
mainL->addWidget(treeView_);
mainL->addWidget(tableView_);
mainL->addWidget(textView_);
setLayout(mainL);
syncWithSettings();
}
示例7: setupUI
// Adds chat and user lists, splitter, etc
void ChannelFrame::setupUI() {
ui.setupUi(this);
QSplitter *splitter = new QSplitter(Qt::Horizontal);
ui.bodyWidgetLayout->addWidget(splitter);// Splitter goes in body widget
chatList = new ChatList;
userList = new UserList;
chatBox = new ChatSubmitBox;
ui.footerContainer->insertWidget(0, chatBox);
chatList->setItemDelegate(new ChatLine(chatList));
splitter->setContentsMargins(QMargins(0, 0, 2, 0));
splitter->setStretchFactor(0, 2);
splitter->addWidget(chatList);
splitter->addWidget(userList);
}
示例8: QMainWindow
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
resize(QDesktopWidget().availableGeometry(this).size() * 0.7);
staffSettings_ = new StaffSettings;
QSplitter *splitter = new QSplitter;
splitter->setContentsMargins(10, 10, 10, 10);
noteSelector_ = new NoteSelector;
noteGuess_ = new NoteGuess;
connect(noteGuess_, SIGNAL(reset()),
this, SLOT(onReset()));
QVBoxLayout *leftPanelLayout = new QVBoxLayout;
leftPanelLayout->addWidget(staffSettings_);
leftPanelLayout->addWidget(noteSelector_);
leftPanelLayout->addStretch(1);
QWidget *leftPanel = new QWidget;
leftPanel->setLayout(leftPanelLayout);
splitter->addWidget(leftPanel);
splitter->addWidget(noteGuess_);
setCentralWidget(splitter);
MidiReader *reader = MidiReader::sharedInstance();
if (!reader->init()) {
QMessageBox::critical(this, tr("NoteTrainer"),
tr("Unable to initialize MIDI reader: ") +
reader->lastErrorMessage());
}
if (!reader->openPort(0)) {
QMessageBox::critical(this, tr("NoteTrainer"),
tr("Unable to open MIDI port: ") +
reader->lastErrorMessage());
}
onReset();
}
示例9: QMainWindow
OLD_MAIN(QWidget* pParent = nullptr)
: QMainWindow(pParent)
{
Q_INIT_RESOURCE(Resources);
// Settings persistence
ReadSettings();
// Appearance LUT
PlayerApperances appearances;
// Build player table model from file
PlayerTableModel* playerTableModel = new PlayerTableModel(this);
playerTableModel->LoadHittingProjections(appearances);
playerTableModel->LoadPitchingProjections(appearances);
playerTableModel->CalculateHittingScores();
playerTableModel->CalculatePitchingScores();
playerTableModel->InitializeTargetValues();
// Draft delegate
DraftDelegate* draftDelegate = new DraftDelegate(playerTableModel);
LinkDelegate* linkDelegate = new LinkDelegate(this);
TagDelegate* tagDelegate = new TagDelegate(this);
// Hitter sort-model
PlayerSortFilterProxyModel* hitterSortFilterProxyModel = new PlayerSortFilterProxyModel(Player::Hitter);
hitterSortFilterProxyModel->setSourceModel(playerTableModel);
hitterSortFilterProxyModel->setSortRole(PlayerTableModel::RawDataRole);
// Hitter table view
QTableView* hitterTableView = MakeTableView(hitterSortFilterProxyModel, true, PlayerTableModel::COLUMN_Z);
hitterTableView->setItemDelegateForColumn(FindColumn(hitterSortFilterProxyModel, PlayerTableModel::COLUMN_DRAFT_BUTTON), draftDelegate);
hitterTableView->setItemDelegateForColumn(FindColumn(hitterSortFilterProxyModel, PlayerTableModel::COLUMN_ID_LINK), linkDelegate);
hitterTableView->setItemDelegateForColumn(FindColumn(hitterSortFilterProxyModel, PlayerTableModel::COLUMN_FLAG), tagDelegate);
hitterTableView->setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::SelectedClicked);
// Context menu
QMenu* contextMenu = new QMenu();
contextMenu->addAction("&Remove Player");
// Apply to hitter table view
hitterTableView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(hitterTableView, &QWidget::customContextMenuRequested, [=](const QPoint& pos) {
QPoint globalPos = hitterTableView->mapToGlobal(pos);
QAction* selectedItem = contextMenu->exec(globalPos);
if (selectedItem) {
auto proxyIndex = hitterTableView->indexAt(pos);
auto srcIndex = hitterSortFilterProxyModel->mapToSource(proxyIndex);
playerTableModel->RemovePlayer(srcIndex.row());
}
});
// Pitcher sort-model
PlayerSortFilterProxyModel* pitcherSortFilterProxyModel = new PlayerSortFilterProxyModel(Player::Pitcher);
pitcherSortFilterProxyModel->setSourceModel(playerTableModel);
pitcherSortFilterProxyModel->setSortRole(PlayerTableModel::RawDataRole);
// Pitcher table view
QTableView* pitcherTableView = MakeTableView(pitcherSortFilterProxyModel, true, PlayerTableModel::COLUMN_Z);
pitcherTableView->setItemDelegateForColumn(FindColumn(pitcherSortFilterProxyModel, PlayerTableModel::COLUMN_DRAFT_BUTTON), draftDelegate);
pitcherTableView->setItemDelegateForColumn(FindColumn(pitcherSortFilterProxyModel, PlayerTableModel::COLUMN_ID_LINK), linkDelegate);
pitcherTableView->setItemDelegateForColumn(FindColumn(pitcherSortFilterProxyModel, PlayerTableModel::COLUMN_FLAG), tagDelegate);
pitcherTableView->setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::SelectedClicked);
// Top/Bottom splitter
QSplitter* topBottomSplitter = new QSplitter(Qt::Vertical);
topBottomSplitter->setContentsMargins(5, 5, 5, 5);
// Hitter/Pitcher tab View
enum PlayerTableTabs { Hitters, Pitchers, Unknown };
QTabWidget* hitterPitcherTabs = new QTabWidget(this);
hitterPitcherTabs->insertTab(PlayerTableTabs::Hitters, hitterTableView, "Hitters");
hitterPitcherTabs->insertTab(PlayerTableTabs::Pitchers, pitcherTableView, "Pitchers");
topBottomSplitter->addWidget(hitterPitcherTabs);
// Tab lookup helper
auto CaterogyToTab = [](uint32_t catergory)
{
switch (catergory)
{
case Player::Hitter:
return PlayerTableTabs::Hitters;
case Player::Pitcher:
return PlayerTableTabs::Pitchers;
default:
return PlayerTableTabs::Unknown;
}
};
// Drafted filter action
QAction* filterDrafted = new QAction(this);
connect(filterDrafted, &QAction::toggled, hitterSortFilterProxyModel, &PlayerSortFilterProxyModel::OnFilterDrafted);
connect(filterDrafted, &QAction::toggled, pitcherSortFilterProxyModel, &PlayerSortFilterProxyModel::OnFilterDrafted);
filterDrafted->setText(tr("Drafted"));
filterDrafted->setToolTip("Toggle Drafted Players");
filterDrafted->setCheckable(true);
filterDrafted->toggle();
QAction* filterReplacement = new QAction(this);
connect(filterReplacement, &QAction::toggled, hitterSortFilterProxyModel, &PlayerSortFilterProxyModel::OnFilterReplacement);
//.........这里部分代码省略.........