Qt - 同时制作水平和垂直的分离器
我有一个 QGridLayout
,上面有一个 QSplitter
。在 QSplitter 中,我有两个带有拆分器的元素,可以让我将拆分器从左向右移动。好吧,就这样就好了。但后来我想添加另一个分离器,但它从上到下移动。 (我将用图像进行解释。)
所以它主要有 2 个分割器,一个从左到右移动,另一个从上到下移动。
我希望你能理解。
QGridLayout *layout = new QGridLayout(this);
QSplitter *splitter = new QSplitter();
text1 = new QPlainTextEdit();
text2 = new QPlainTextEdit();
splitter->addWidget(text1);
splitter->addWidget(text2);
text1->resize(800, this->height());
layout->addWidget(splitter, 1, 0);
browser = new QTextBrowser();
browser->resize(1, 1);
layout->addWidget(browser, 2, 0);
setLayout(layout);
这里我只添加了 1 个分离器,因为我不知道如何做第二个。
I have a QGridLayout
with a QSplitter
on it. In that QSplitter
I have two elements with a splitter that lets me move the splitter from left to right. Fine, there it's fine. But then I want to add another splitter but that moves up to down. (I'll explain with an image.)
So it's mostly having 2 splitters, one that moves left-to-right and other that moves up-to-down.
I hope you understand.
QGridLayout *layout = new QGridLayout(this);
QSplitter *splitter = new QSplitter();
text1 = new QPlainTextEdit();
text2 = new QPlainTextEdit();
splitter->addWidget(text1);
splitter->addWidget(text2);
text1->resize(800, this->height());
layout->addWidget(splitter, 1, 0);
browser = new QTextBrowser();
browser->resize(1, 1);
layout->addWidget(browser, 2, 0);
setLayout(layout);
Here i add only 1 splitter, since i don't know how to do the 2nd one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该能够轻松地根据您的需求进行调整。这个想法是为前两个元素创建一个容器,然后通过分离器将容器与第三个元素连接起来。
You should be able to adapt this for your needs easily. The idea is to create a container for the first two elements, then connect the container with the 3rd element all via splitters.