//! [0] int main(int argc, char *argv[]) { QApplication app(argc, argv); if (app.arguments().count() != 2) { qFatal("Error - expected executable path as argument"); return 1; } QX11EmbedContainer container; container.show(); QProcess process(&container); QString executable(app.arguments()[1]); QStringList arguments; arguments << QString::number(container.winId()); process.start(executable, arguments); int status = app.exec(); process.close(); return status; }
void VstPlugin::createUI( QWidget * parent ) { if ( m_pluginWidget ) { qWarning() << "VstPlugin::createUI called twice"; m_pluginWidget->setParent( parent ); return; } if( m_pluginWindowID == 0 ) { return; } QWidget* container = nullptr; #if QT_VERSION >= 0x050100 if (m_embedMethod == "qt" ) { QWindow* vw = QWindow::fromWinId(m_pluginWindowID); container = QWidget::createWindowContainer(vw, parent ); container->installEventFilter(this); } else #endif #ifdef LMMS_BUILD_WIN32 if (m_embedMethod == "win32" ) { QWidget * helper = new QWidget; QHBoxLayout * l = new QHBoxLayout( helper ); QWidget * target = new QWidget( helper ); l->setSpacing( 0 ); l->setMargin( 0 ); l->addWidget( target ); // we've to call that for making sure, Qt created the windows helper->winId(); HWND targetHandle = (HWND)target->winId(); HWND pluginHandle = (HWND)(intptr_t)m_pluginWindowID; DWORD style = GetWindowLong(pluginHandle, GWL_STYLE); style = style & ~(WS_POPUP); style = style | WS_CHILD; SetWindowLong(pluginHandle, GWL_STYLE, style); SetParent(pluginHandle, targetHandle); DWORD threadId = GetWindowThreadProcessId(pluginHandle, NULL); DWORD currentThreadId = GetCurrentThreadId(); AttachThreadInput(currentThreadId, threadId, true); container = helper; RemotePlugin::showUI(); } else #endif #ifdef LMMS_BUILD_LINUX if (m_embedMethod == "xembed" ) { if (parent) { parent->setAttribute(Qt::WA_NativeWindow); } QX11EmbedContainer * embedContainer = new QX11EmbedContainer( parent ); connect(embedContainer, SIGNAL(clientIsEmbedded()), this, SLOT(handleClientEmbed())); embedContainer->embedClient( m_pluginWindowID ); container = embedContainer; } else #endif { qCritical() << "Unknown embed method" << m_embedMethod; return; } container->setFixedSize( m_pluginGeometry ); container->setWindowTitle( name() ); m_pluginWidget = container; }
int BtCompany_createMainWindows_Post ( BtCompany *etpv ) { /// Creamos un docwindow. g_docteclado = new QDockWidget ( "Teclado", g_main ); g_docteclado->setFeatures ( QDockWidget::AllDockWidgetFeatures ); g_main->addDockWidget ( Qt::TopDockWidgetArea, g_docteclado ); g_docteclado->hide(); g_proc = new QProcess(); /// Hay varios teclados embebidos que se pueden utilizar. Pero el que mejor funciona /// Es el matchbox-keyboard /* g_proc->start("kvkbd"); if (!g_proc->waitForStarted()) return; QString winId = ""; while (winId == "") winId = blWindowId("kvkbd"); */ /* g_proc->start("klavier"); if (!g_proc->waitForStarted()) return; QString winId = ""; while (winId == "") winId = blWindowId("klavier"); */ g_proc->start ( "matchbox-keyboard -xid es" ); if ( !g_proc->waitForStarted() ) { return 0; } // end if g_proc->waitForReadyRead(); QString winId = ""; winId = g_proc->readAllStandardOutput(); #ifndef Q_OS_WIN32 QX11EmbedContainer *container = new QX11EmbedContainer ( g_docteclado ); container->embedClient ( winId.toInt() ); g_docteclado->setWidget ( container ); #endif BlToolButton *boton_teclado = new BlToolButton(etpv, etpv); boton_teclado->setObjectName(QString::fromUtf8("mui_teclado")); boton_teclado->setMinimumSize(QSize(72, 72)); boton_teclado->setMaximumSize(QSize(200, 72)); boton_teclado->setFocusPolicy(Qt::NoFocus); QIcon icon; icon.addFile(QString::fromUtf8(":/Images/company.png"), QSize(), QIcon::Normal, QIcon::Off); boton_teclado->setIcon(icon); boton_teclado->setIconSize(QSize(32, 32)); boton_teclado->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); boton_teclado->setText(N_("Teclado", 0)); QFrame *fr = g_main->findChild<QFrame *> ( "mui_frameabrevs" ); if ( fr ) { QHBoxLayout *m_hboxLayout1 = fr->findChild<QHBoxLayout *> ( "hboxLayout1" ); if ( !m_hboxLayout1 ) { m_hboxLayout1 = new QHBoxLayout ( fr ); m_hboxLayout1->setSpacing ( 5 ); m_hboxLayout1->setMargin ( 5 ); m_hboxLayout1->setObjectName ( QString::fromUtf8 ( "hboxLayout1" ) ); } // end if m_hboxLayout1->addWidget (boton_teclado); } // end if return 0; }
void VstPlugin::showEditor( QWidget * _parent, bool isEffect ) { QWidget * w = pluginWidget(); if( w ) { #ifdef LMMS_BUILD_WIN32 // hide sw, plugin window wrapper on win32 // this is obtained from pluginWidget() if( isEffect ) { w->setWindowFlags( Qt::FramelessWindowHint ); w->setAttribute( Qt::WA_TranslucentBackground ); } else { w->setWindowFlags( Qt::WindowCloseButtonHint ); } #endif w->show(); return; } #ifdef LMMS_BUILD_LINUX if( m_pluginWindowID == 0 ) { return; } m_pluginWidget = new QWidget( _parent ); m_pluginWidget->setFixedSize( m_pluginGeometry ); m_pluginWidget->setWindowTitle( name() ); if( _parent == NULL ) { vstSubWin * sw = new vstSubWin( gui->mainWindow()->workspace() ); if( isEffect ) { sw->setAttribute( Qt::WA_TranslucentBackground ); sw->setWindowFlags( Qt::FramelessWindowHint ); sw->setWidget( m_pluginWidget ); #if QT_VERSION < 0x050000 QX11EmbedContainer * xe = new QX11EmbedContainer( sw ); xe->embedClient( m_pluginWindowID ); xe->setFixedSize( m_pluginGeometry ); xe->show(); #endif } else { sw->setWindowFlags( Qt::WindowCloseButtonHint ); sw->setWidget( m_pluginWidget ); #if QT_VERSION < 0x050000 QX11EmbedContainer * xe = new QX11EmbedContainer( sw ); xe->embedClient( m_pluginWindowID ); xe->setFixedSize( m_pluginGeometry ); xe->move( 4, 24 ); xe->show(); #endif } } #endif if( m_pluginWidget ) { m_pluginWidget->show(); } }