English 中文(简体)
qt - 我如何用一组纽子分裂?
原标题:qt - How do I make a splitter with a set of buttons on it?

是否有任何人面临将丁顿(或任何其他植被)放在分管的顶端? 我曾试图得到处理,确定其布局,并在那里实施控制,但我只想看一看。

我的主要目标是创建一种精选的方言,如下文所示:“Dialog

我得到的东西:
“

Code:

QDialog dialog = new QDialog();
dialog.setLayout(new QVBoxLayout());
QSplitter splitter = new QSplitter();

splitter.setSizePolicy(new QSizePolicy(QSizePolicy.Policy.MinimumExpanding, QSizePolicy.Policy.Fixed));
splitter.addWidget(new QListWidget());
splitter.addWidget(new QTableWidget());
dialog.layout().addWidget(splitter);

QSplitterHandle h = splitter.handle(1);
h.setFixedWidth(30); // I added this line to show the splitter handle
QVBoxLayout lt = new QVBoxLayout();
lt.setSpacing(0);
lt.setMargin(0);
lt.addWidget(new QPushButton("Hello", dialog));
lt.addWidget(new QPushButton("Good bye", dialog));
h.setLayout(lt);

dialog.show();
最佳回答

This gives better result:

// h.setFixedWidth(30);
splitter.setHandleWidth(30);

为了取得更好的结果,我建议把QSplitterHandle和重修改为。 http://developer.qt.nokia.com/doc/qt-4.8/qsplitterhandle.html” rel=“nofollow”>QSplitterHandle documentation

You can change layout setting to get exact button positions. For example:

lt.addStrecth();

为了消除“救济”-禁运,你必须从QSplitterHandle中排下级,并重新实施<条码>。

问题回答

暂无回答




相关问题
How to start to create an application GUI using C#?

HI! I am new to C# and plan to use it for my application GUI. I am trying to make my GUI similar to SPSS:http://www.spss.com/images/08/statistics_screens/ez_rfm-big.jpg Is this easy in C#? Is there ...

Automatic height of edit box

My shoes application has three items stacked on top of each other (with a stack, of course), in order: A banner An edit box Two buttons in a flow What I want to do is have the banner stay at it s ...

Search by using the keyboard in a list/grid - algorithm

I need to implement a custom search in a grid and I would like to find some user interface guidelines that explain the standard way to implement it. I mean this kind of search that is initiated by ...

UI And TcpClient Issue in vb.net

I m having some problems with a small ircbot i m writing. Basically I connect to the server using a tcpclient in a seperate class, which also runs on its own thread. I want to display the server text ...

UI Convention: Shortcut key for application exit? [closed]

Is there a convention for the shortcut keys for application exit? Some applications uses Alt+X some others use Ctrl+ X and Ctrl+Q. Applications like FF and IE doesnot assign a shortcut at all. So is ...

热门标签