- qtgui
- qtdbus
- qtwidgets
- qtcore
- dtkcore
- qsettingbackend_zh
- dobject_zh
- abstractappender_zh
- abstractstringappender_zh
- dfilewatcher_zh
- outputdebugappender_zh
- dsettingsbackend_zh
- drecentmanager_zh
- ddesktopentry_zh
- consoleappender_zh
- gsettingsbackend_zh
- dsettingsgroup_zh
- dlogmanager_zh
- fileappender_zh
- dsettings_zh
- dfilesystemwatcher_zh
- dfilewatchermanager_zh
- dbasefilewatcher_zh
- dtkgui
- dtkwidget
- dviewitemaction_zh
- dstandarditem_zh
- dfiledialog_zh
- dclipeffectwidget_zh
- danchors_zh
- dgraphicsclipeffect_zh
- dstyle_zh
- dcoloredprogressbar_zh
- dbuttonboxbutton_zh
- dlabel_zh
- dtiplabel_zh
- darrowlinedrawer_zh
- daboutdialog_zh
- dsettingswidgetfactory_zh
- dsearchcombobox_zh
- dcrumbedit_zh
- dcommandlinkbutton_zh
- dsettingsdialog_zh
- dwindowoptionbutton_zh
- dspinner_zh
- dsimplelistview_zh
- dwaterprogress_zh
- dmainwindow_zh
- dhidpihelper_zh
- dslider_zh
- dpasswordedit_zh
- danchorinfo_zh
- dmpriscontrol_zh
- darrowbutton_zh
- dbackgroundgroup_zh
- dcircleprogress_zh
- dwarningbutton_zh
- dwindowclosebutton_zh
- dvideowidget_zh
- dfilechooseredit_zh
- dblureffectwidget_zh
- darrowrectangle_zh
- dsearchedit_zh
- dfloatingmessage_zh
- dswitchlineexpand_zh
- dtabbar_zh
- dlineedit_zh
- danchorsbase_zh
- dstylediconengine_zh
- dwindowmaxbutton_zh
- dpageindicator_zh
- dsuggestbutton_zh
- dapplicationsettings_zh
- dtooltip_zh
- dwindowminbutton_zh
- ddrawer_zh
- dtitlebar_zh
- dsimplelistitem_zh
- dpicturesequenceview_zh
dforeignwindow_zh
Class::DForeignWindow
暂无该属性
Detailed Description
~chinese ~chinese
一个用于获取本地窗口信息的类,继承于 QWindow,支持 QWindow::geometry ~chinese QWindow::x QWindow::y QWindow::width QWindow::height ~chinese QWindow::title QWindow::flags QWindow::visibility QWindow::type ~chinese QWindow::windowStates QWindow::windowState 等接口的使用,另外扩展 ~chinese 增加了一部分接口,方面更加详细的获取窗口信息。依赖于 dxcb 插件,在未加载 ~chinese dxcb 插件的应用中使用时结果未知 ~chinese ~chinese
~chinese
See also DWindowManagerHelper::currentWorkspaceWindowsDApplication::loadDXcbPluginDApplication::isDXcbPlatform
DForeignWindow::Q_PROPERTY
int Q_PROPERTY(int )
DForeignWindow::fromWinId
DForeignWindow * fromWinId(int id) ~chinese
DForeignWindow::fromWinId ~chinese 使用这个窗口id创建一个 DForeignWindow 对象,此对象不会被加到 QGuiApplication::allWindows ~chinese 中。一般应用在需要获取一个本地窗口信息的场景。示例: ~chinese
// a.cpp
int main(int argc, char *argv[])
{
DApplication a(argc, argv);
QWidget w;
w.setWindowTitle("deepin");
w.show();
QFile app_win_id("/tmp/window_id.txt");
if (app_win_id.open(QFile::WriteOnly)) {
app_win_id.write(QByteArray::number(w.winId()));
app_win_id.close();
}
return a.exec();
}
~chinese
// b.cpp
int main(int argc, char *argv[])
{
DApplication::loadDXcbPlugin();
DApplication a(argc, argv);
DForeignWindow *fw = nullptr;
QFile app_win_id("/tmp/window_id.txt");
if (app_win_id.open(QFile::ReadOnly)) {
fw = DForeignWindow::fromWinId(app_win_id.readAll().toInt());
}
if (fw) {
qDebug() << fw->title();
fw->connect(fw, &DForeignWindow::widthChanged, [&] {
qDebug() << fw->width();
});
}
return a.exec();
}
UnknownCommand先启动应用
a UnknownCommand 再启动应用
b
~chinese 在应用 b 启动后将看到如下输出: ~chinese
"deepin"
当改变应用 a 中的窗口宽度时,在应用 b 中会看到宽度的输出 ~chinese id ~chinese Returns ~chinese
Warning: 不要尝试对由本应用创建的窗口调用此接口,可能会导致窗口行为发生不可逆转的变化
DForeignWindow::wmClass
int wmClass() const
DForeignWindow::pid
int pid() const
DForeignWindow::pidChanged
void pidChanged()
DForeignWindow::event
bool event(int *)