本文整理汇总了C#中Qyoto.QWidget.SetLayout方法的典型用法代码示例。如果您正苦于以下问题:C# QWidget.SetLayout方法的具体用法?C# QWidget.SetLayout怎么用?C# QWidget.SetLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Qyoto.QWidget
的用法示例。
在下文中一共展示了QWidget.SetLayout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainWindow
public MainWindow()
{
m_layout = new QHBoxLayout();
m_label = new QLabel("Hello Qyoto!");
m_widget = new QWidget(this);
m_layout.AddWidget(m_label);
m_widget.SetLayout(m_layout);
SetCentralWidget(m_widget);
}
示例2: TabbedChatsWindow
public TabbedChatsWindow()
{
// FIXME: This doesn't work very well in most themes...
//this.SetStyleSheet("QTabWidget::pane { border: 0px; }");
// The tab widget messes up this background color.
this.SetStyleSheet("QTabWidget > QWidget { background: palette(window); }");
m_Tabs = new QTabWidget();
m_Tabs.tabPosition = QTabWidget.TabPosition.South;
QToolButton newTabButton = new QToolButton(m_Tabs);
newTabButton.AutoRaise = true;
newTabButton.SetDefaultAction(new QAction(Gui.LoadIcon("tab-new", 16), "New Tab", newTabButton));
newTabButton.SetToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly);
QObject.Connect<QAction>(newTabButton, Qt.SIGNAL("triggered(QAction*)"), HandleNewTab);
m_Tabs.SetCornerWidget(newTabButton, Qt.Corner.BottomLeftCorner);
QHBoxLayout rightButtonsLayout = new QHBoxLayout();
rightButtonsLayout.SetContentsMargins(0, 0, 0, 0);
rightButtonsLayout.Spacing = 0;
QToolButton closeTabButton = new QToolButton(m_Tabs);
closeTabButton.SetToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly);
closeTabButton.AutoRaise = true;
closeTabButton.SetDefaultAction(new QAction(Gui.LoadIcon("window-close", 16), "Close Tab", closeTabButton));
QObject.Connect<QAction>(closeTabButton, Qt.SIGNAL("triggered(QAction*)"), HandleCloseTab);
rightButtonsLayout.AddWidget(closeTabButton);
QMenu menu = new QMenu(this);
menu.AddAction(new QIcon(), "No Recently Closed Tabs");
QToolButton trashButton = new QToolButton(m_Tabs);
trashButton.SetToolButtonStyle(Qt.ToolButtonStyle.ToolButtonIconOnly);
trashButton.AutoRaise = true;
trashButton.PopupMode = QToolButton.ToolButtonPopupMode.InstantPopup;
trashButton.SetMenu(menu);
trashButton.SetDefaultAction(new QAction(Gui.LoadIcon("user-trash", 16), "Recently Closed Tabs", trashButton));
rightButtonsLayout.AddWidget(trashButton);
// FIXME: This looks bad.
//rightButtonsLayout.AddWidget(new QSizeGrip(this));
QWidget rightButtonsContainer = new QWidget(m_Tabs);
rightButtonsContainer.SetLayout(rightButtonsLayout);
m_Tabs.SetCornerWidget(rightButtonsContainer, Qt.Corner.BottomRightCorner);
QVBoxLayout layout = new QVBoxLayout(this);
layout.SetContentsMargins(0, 0, 0, 0);
layout.AddWidget(m_Tabs, 1, 0);
this.SetLayout(layout);
QObject.Connect<int>(m_Tabs, Qt.SIGNAL("currentChanged(int)"), HandleCurrentChanged);
this.SetGeometry(0, 0, 445, 370);
Gui.CenterWidgetOnScreen(this);
QAction closeAction = new QAction(this);
QObject.Connect<bool>(closeAction, Qt.SIGNAL("triggered(bool)"), HandleCloseActionTriggered);
closeAction.Shortcut = new QKeySequence("Ctrl+w");
this.AddAction(closeAction);
0.UpTo(9).ForEach(num => {
QAction action = new QAction(this);
action.Shortcut = new QKeySequence("Alt+" + num.ToString());
QObject.Connect(action, Qt.SIGNAL("triggered(bool)"), delegate {
m_Tabs.CurrentIndex = num - 1;
});
this.AddAction(action);
});
QAction nextTabAction = new QAction(this);
nextTabAction.Shortcut = new QKeySequence(QKeySequence.StandardKey.NextChild);
QObject.Connect(nextTabAction, Qt.SIGNAL("triggered(bool)"), delegate {
if (m_Tabs.CurrentIndex == m_Tabs.Count - 1)
m_Tabs.CurrentIndex = 0;
else
m_Tabs.CurrentIndex += 1;
});
this.AddAction(nextTabAction);
QAction prevTabAction = new QAction(this);
prevTabAction.Shortcut = new QKeySequence(QKeySequence.StandardKey.PreviousChild);
QObject.Connect(prevTabAction, Qt.SIGNAL("triggered(bool)"), delegate {
if (m_Tabs.CurrentIndex == 0)
m_Tabs.CurrentIndex = m_Tabs.Count - 1;
else
m_Tabs.CurrentIndex -= 1;
});
var accountService = ServiceManager.Get<AccountService>();
accountService.AccountAdded += HandleAccountAdded;
accountService.AccountRemoved += HandleAccountRemoved;
foreach (Account account in accountService.Accounts)
HandleAccountAdded(account);
var settingsService = ServiceManager.Get<SettingsService>();
if (settingsService.Has("ChatsWindowGeometry")) {
var geometry = settingsService.Get<byte[]>("ChatsWindowGeometry");
base.RestoreGeometry(QByteArrayConverter.FromArray(geometry));
//.........这里部分代码省略.........