本文整理汇总了C++中QSplitter::setOpaqueResize方法的典型用法代码示例。如果您正苦于以下问题:C++ QSplitter::setOpaqueResize方法的具体用法?C++ QSplitter::setOpaqueResize怎么用?C++ QSplitter::setOpaqueResize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSplitter
的用法示例。
在下文中一共展示了QSplitter::setOpaqueResize方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QFont font("ZYSong18030",12);
a.setFont(font);
//主分割窗口
QSplitter *splitterMain =new QSplitter(Qt::Horizontal,0);
QTextEdit *textLeft =new QTextEdit(QObject::tr("Left Widget"),splitterMain);
textLeft->setAlignment(Qt::AlignCenter);
//右部分割窗口
QSplitter *splitterRight =new QSplitter(Qt::Vertical,splitterMain);
splitterRight->setOpaqueResize(false);
QTextEdit *textUp =new QTextEdit(QObject::tr("Top Widget"),splitterRight);
textUp->setAlignment(Qt::AlignCenter);
QTextEdit *textBottom =new QTextEdit(QObject::tr("Bottom Widget"),splitterRight);
textBottom->setAlignment(Qt::AlignCenter);
splitterMain->setStretchFactor(1,1);
splitterMain->setWindowTitle(QObject::tr("Splitter"));
splitterMain->show();
//MainWindow w;
//w.show();
return a.exec();
}
示例2: splitViewSpace
void KateViewManager::splitViewSpace( KateViewSpace* vs, // = 0
Qt::Orientation o )// = Qt::Horizontal
{
// emergency: fallback to activeViewSpace, and if still invalid, abort
if (!vs) vs = activeViewSpace();
if (!vs) return;
// get current splitter, and abort if null
QSplitter *currentSplitter = qobject_cast<QSplitter*>(vs->parentWidget());
if (!currentSplitter) return;
// index where to insert new splitter/viewspace
const int index = currentSplitter->indexOf( vs );
// create new viewspace
KateViewSpace* vsNew = new KateViewSpace( this );
// only 1 children -> we are the root container. So simply set the orientation
// and add the new view space, then correct the sizes to 50%:50%
if (currentSplitter->count() == 1)
{
if( currentSplitter->orientation() != o )
currentSplitter->setOrientation( o );
QList<int> sizes = currentSplitter->sizes();
sizes << (sizes.first() - currentSplitter->handleWidth() ) / 2;
sizes[0] = sizes[1];
currentSplitter->insertWidget( index, vsNew );
currentSplitter->setSizes( sizes );
}
else
{
// create a new QSplitter and replace vs with the splitter. vs and newVS are
// the new children of the new QSplitter
QSplitter* newContainer = new QSplitter( o );
newContainer->setOpaqueResize( KGlobalSettings::opaqueResize() );
QList<int> currentSizes = currentSplitter->sizes();
newContainer->addWidget( vs );
newContainer->addWidget( vsNew );
currentSplitter->insertWidget( index, newContainer );
newContainer->show();
// fix sizes of children of old and new splitter
currentSplitter->setSizes( currentSizes );
QList<int> newSizes = newContainer->sizes();
newSizes[0] = (newSizes[0] + newSizes[1] - newContainer->handleWidth()) / 2;
newSizes[1] = newSizes[0];
newContainer->setSizes( newSizes );
}
m_viewSpaceList.append( vsNew );
activeViewSpace()->setActive( false );
vsNew->setActive( true, true );
vsNew->show();
createView ((KTextEditor::Document*)activeView()->document());
updateViewSpaceActions ();
}
示例3: newSplitter
ADS_NAMESPACE_BEGIN
// Static Helper //////////////////////////////////////////////////////
static QSplitter* newSplitter(Qt::Orientation orientation = Qt::Horizontal, QWidget* parent = 0)
{
QSplitter* s = new QSplitter(orientation, parent);
s->setProperty("ads-splitter", QVariant(true));
s->setChildrenCollapsible(false);
s->setOpaqueResize(false);
return s;
}
示例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: createWidgets
void MainWindow::createWidgets()
{
setCentralWidget(new QWidget(this));
QVBoxLayout* mainFormBaseLayout = new QVBoxLayout(centralWidget(), 1, 1);
QSplitter* splitter = new QSplitter(centralWidget());
splitter->setOrientation( Qt::Vertical );
mainFormBaseLayout->addWidget(splitter);
m_tabEditor = new EditorTabWidget(splitter, this);
splitter->setCollapsible(m_tabEditor, false);
splitter->setOpaqueResize(true);
QTabWidget* tabDebug = new QTabWidget(splitter);
splitter->setCollapsible(tabDebug, false);
tabDebug->setGeometry(0,0,0,height()/15);
QWidget* globalVarTab = new QWidget(tabDebug);
QVBoxLayout* globalVarTabLayout = new QVBoxLayout(globalVarTab, 1, 1);
m_globaVarList = new VariablesListView(globalVarTab);
globalVarTabLayout->addWidget(m_globaVarList);
tabDebug->insertTab(globalVarTab, QString("Global"));
QWidget* tabStack = new QWidget(tabDebug);
QVBoxLayout* varTabLayout = new QVBoxLayout(tabStack, 1, 1);
QHBoxLayout* stackComboLayout = new QHBoxLayout(0, 6, 6);
QLabel* stackLabel = new QLabel(tabStack);
stackLabel->setText(("Stack:"));
stackLabel->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, stackLabel->sizePolicy().hasHeightForWidth()));
stackComboLayout->addWidget(stackLabel);
m_stackCombo = new DebuggerComboStack(tabStack);
stackComboLayout->addWidget(m_stackCombo);
varTabLayout->addLayout(stackComboLayout);
m_localVarList= new VariablesListView(tabStack);
varTabLayout->addWidget(m_localVarList);
tabDebug->insertTab(tabStack, QString("Local"));
QWidget* tabWatch = new QWidget(tabDebug);
QVBoxLayout* watchTabLayout = new QVBoxLayout(tabWatch, 1, 1);
QHBoxLayout* addWatchLayout = new QHBoxLayout(0, 6, 6);
QLabel* addLabel = new QLabel(tabWatch);
addLabel->setText(("Watch:"));
addWatchLayout->addWidget(addLabel);
m_edAddWatch = new KLineEdit(tabWatch);
m_edAddWatch->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, m_edAddWatch->sizePolicy().hasHeightForWidth()));
addWatchLayout->addWidget(m_edAddWatch);
m_btAddWatch = new KPushButton(tabWatch);
m_btAddWatch->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, m_btAddWatch->sizePolicy().hasHeightForWidth()));
m_btAddWatch->setText(("Add"));
addWatchLayout->addWidget(m_btAddWatch);
QSpacerItem* spacer = new QSpacerItem(430, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
addWatchLayout->addItem(spacer);
watchTabLayout->addLayout(addWatchLayout);
m_watchList = new WatchListView(tabWatch);
watchTabLayout->addWidget(m_watchList);
tabDebug->insertTab(tabWatch, QString("Watch"));
QWidget* breakpointTab = new QWidget(tabDebug);
QVBoxLayout* breakpointTabLayout = new QVBoxLayout(breakpointTab, 1, 1);
m_breakpointList = new BreakpointListView(breakpointTab);
breakpointTabLayout->addWidget(m_breakpointList);
tabDebug->insertTab(breakpointTab, QString("Breakpoints"));
QWidget* logTab = new QWidget(tabDebug);
QVBoxLayout* logTabLayout = new QVBoxLayout(logTab, 1, 1);
m_logListView = new LogListView(logTab);
logTabLayout->addWidget(m_logListView);
tabDebug->insertTab(logTab, QString("Messages"));
QWidget* outputTab = new QWidget(tabDebug);
QVBoxLayout* outputTabLayout = new QVBoxLayout(outputTab, 1, 1);
m_edOutput = new KTextEdit(outputTab);
outputTabLayout->addWidget(m_edOutput);
m_edOutput->setReadOnly(true);
m_edOutput->setTextFormat(Qt::PlainText);
m_edOutput->setPaper( QBrush(QColor("white")));
/*
KTextEditor::Document* doc = KTextEditor::EditorChooser::createDocument(
0L, "KTextEditor::Document");
//doc->setReadWrite(false);
m_edOutput = dynamic_cast<KTextEditor::EditInterface*>(doc);
m_edOutput->setText("oioi");
outputTabLayout->addWidget(doc->createView(outputTab));
*/
tabDebug->insertTab(outputTab, QString("Output"));
//.........这里部分代码省略.........
示例6: QMainWindow
ApplicationWindow::ApplicationWindow()
: QMainWindow()
{
setWindowTitle("application main window");
// init some values
QFont boldfont;
QLabel *label;
QFrame *w;
QVBoxLayout *box;
appwin = this;
currClient = NULL;
dialog = NULL;
plugins = NULL;
// set a proper font & layout
setFont(QFont("Helvetica", 8));
// initialize two timer
// timer.....waits for disconneting vrb clients
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(timerDone()));
// create the menus and toolbar buttons
createMenubar();
createToolbar();
//make a central widget to contain the other widgets
QSplitter *central = new QSplitter(Qt::Vertical, this);
central->setObjectName("main");
central->setOpaqueResize(true);
// create a horizontal splitter window
QSplitter *split = new QSplitter(Qt::Horizontal, central);
split->setObjectName("top");
split->setOpaqueResize(true);
// create the table list for the left side
// contains one entry for each vrb client
w = new QFrame(split);
w->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
box = new QVBoxLayout(w);
box->setMargin(5);
table = new QTreeWidget(w);
QStringList labels;
labels << "Master"
<< "ID"
<< "Group"
<< "Host";
labels << "User"
<< "Email"
<< "URL"
<< "IP";
table->setHeaderLabels(labels);
table->setMinimumSize(table->sizeHint());
connect(table, SIGNAL(itemClicked(QTreeWidgetem *)),
this, SLOT(showBPS(QTreeWidgetItem *)));
connect(table, SIGNAL(rightButtonClicked(QTreeWidgetItem *, const QPoint &, int)),
this, SLOT(popupCB(QTreeWidgetItem *, const QPoint &, int)));
box->addWidget(table);
// create the tabwidget for the right side
createTabWidget(split);
// create a message area for the bottom
msgFrame = new QFrame(central);
msgFrame->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
box = new QVBoxLayout(msgFrame);
box->setMargin(5);
label = new QLabel(msgFrame);
label->setText("Message Area");
label->setAlignment(Qt::AlignCenter);
//label->setFont( boldfont );
msg = new QTextEdit(msgFrame);
box->addWidget(label);
box->addWidget(msg);
msgFrame->hide();
// create a file browser
browser = new VRBFileDialog(this);
// create a popupmenu -- available for each vrb client in the table list
popup = new VRBPopupMenu(table);
popup->addAction("&Delete", this, SLOT(deleteItem()));
popup->addAction("&Configure", this, SLOT(configItem()));
//.........这里部分代码省略.........
示例7: sizePolicy
//****************************************************************************
MainWindow::MainWindow (QWidget* parent, Qt::WFlags fl)
{
// Setup the QRAP error handling system
QRAP_SET_ALERT_CALLBACK((AlertCallback)(Qrap::MainWindowAlert));
CreateActions();
CreateMenus();
CreateToolBars();
CreateStatusBar();
ReadSettings();
// Create the clipboard
clipboard = QApplication::clipboard();
// Set the window title
setWindowTitle("Q-Rap Database Interface");
setWindowIcon(QIcon(":images/logo_icon.png"));
// Check if there are any system preferences
if(gDb.GetSetting("location")=="")
{
// gDb.SetSetting("location","DD.dddd");
gDb.SetSetting("sensitivity","dBm");
gDb.SetSetting("power","dBm");
gDb.SetSetting("eirp","dBm");
gDb.SetSetting("impedence","50");
gDb.SetSetting("predictioneirp","explicit");
gDb.SetSetting("location","DD:MM:SS");
gDb.SetSetting("mode","normal");
gDb.SetSetting("DisplayUnits","dBm");
gDb.SetSetting("TechType","0:NULL");
gDb.SetSetting("RqSN","8.00");
gDb.SetSetting("FadeMargin","3.00");
gDb.SetSetting("RxMin","-110.00");
gDb.SetSetting("RqCiCo","9.00");
gDb.SetSetting("RqCiad","-9.00");
gDb.SetSetting("RqEbNo","8.00");
gDb.SetSetting("kFactorServer","1.00");
gDb.SetSetting("kFactorInt","2.5");
gDb.SetSetting("UseClutter","false");
gDb.SetSetting("BTLDir","/home/");
gDb.SetSetting("OutputDir","/home");
gDb.SetSetting("SiteSelectSense","150.00");
gDb.SetSetting("PlotResolution","90.00");
gDb.SetSetting("DownLink","true");
} // if GetSetting(location)
// QWidget* gridLayout_1 = new QWidget(this);
// gridLayout_1->setObjectName(QString::fromUtf8("gridLayout_1"));
//gridLayout_1->setGeometry(QRect(0,70,790,180));
// setCentralWidget(gridLayout_1);
// QGridLayout* gridLayout1 = new QGridLayout(gridLayout_1);
// gridLayout1->setSpacing(6);
// gridLayout1->setMargin(0);
// gridLayout1->setObjectName(QString::fromUtf8("gridLayout1"));
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
sizePolicy.setHorizontalStretch(200);
sizePolicy.setVerticalStretch(200);
QSplitter* splitter;
splitter = new QSplitter(this);
splitter->setObjectName(QString::fromUtf8("splitter"));
splitter->setOrientation(Qt::Horizontal);
splitter->setOpaqueResize(true);
splitter->setSizePolicy(sizePolicy);
sizePolicy.setHeightForWidth(splitter->sizePolicy().hasHeightForWidth());
setCentralWidget(splitter);
rapTab = new RapTab(splitter);
rapTab->setGeometry(QRect(10,10,1550,450));
rapTab->setMinimumSize(QSize(100, 100));
rapTab->setSizePolicy(sizePolicy);
splitter->addWidget(rapTab);
Filter = new cFilter(splitter);
Filter->setGeometry(QRect(10,10,350,450));
Filter->setMinimumSize(QSize(100, 100));
Filter->setSizePolicy(sizePolicy);
splitter->addWidget(Filter);
setMaximumHeight(700);
showMaximized ();
// QSpacerItem *spacerItem1 = new QSpacerItem(1, 90, QSizePolicy::Minimum, QSizePolicy::Minimum);
// gridLayout1->addItem(spacerItem1, 0, 1, 1, 1);
// QSpacerItem *spacerItem = new QSpacerItem(1, 400, QSizePolicy::Minimum, QSizePolicy::Maximum);
// gridLayout1->addItem(spacerItem, 1, 1, 1, 1);
// Create the main widget
// CreateDockingTab(Body);
}
示例8: 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();
}