本文整理匯總了C#中Qyoto.QWidget.TopLevelWidget方法的典型用法代碼示例。如果您正苦於以下問題:C# QWidget.TopLevelWidget方法的具體用法?C# QWidget.TopLevelWidget怎麽用?C# QWidget.TopLevelWidget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Qyoto.QWidget
的用法示例。
在下文中一共展示了QWidget.TopLevelWidget方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ShowAccountSelectMenu
public static Account ShowAccountSelectMenu(QWidget attachWidget)
{
AccountService accountService = ServiceManager.Get<AccountService>();
if (accountService.ConnectedAccounts.Count == 0) {
var widget = (attachWidget != null) ? attachWidget.TopLevelWidget() : Gui.MainWindow;
QMessageBox.Critical(widget, "Synapse", "You are not connected.");
return null;
}
Account selectedAccount = null;
if (accountService.ConnectedAccounts.Count > 1) {
QMenu menu = new QMenu();
menu.AddAction("Select Account:").SetDisabled(true);
foreach (Account account in accountService.ConnectedAccounts) {
QAction action = menu.AddAction(account.Jid.ToString());
if (menu.ActiveAction() == null)
menu.SetActiveAction(action);
}
var pos = (attachWidget != null) ? attachWidget.MapToGlobal(new QPoint(0, attachWidget.Height())) : QCursor.Pos();
QAction selectedAction = menu.Exec(pos);
if (selectedAction != null) {
selectedAccount = accountService.GetAccount(new jabber.JID(selectedAction.Text));
}
} else {
selectedAccount = accountService.ConnectedAccounts[0];
}
return selectedAccount;
}
示例2: AvatarProviderTab
public AvatarProviderTab(IAvatarProvider provider, QWidget parent)
: base(parent)
{
m_Provider = provider;
QObject.Connect(base.Page().MainFrame(), Qt.SIGNAL("javaScriptWindowObjectCleared()"), delegate {
base.Page().MainFrame().AddToJavaScriptWindowObject("AvatarSelectDialog", parent.TopLevelWidget());
});
base.SetHtml(String.Empty);
}