#include "mainwindow.h"
MainWindow
::MainWindow(QWidget *parent
) : QWidget(parent
), ui
(new Ui
::Prototype_tab){
showMaximized();
ui->setupUi(this);
connect(ui->startButton, SIGNAL(pressed()), this, SLOT(startPrototype()));
connect(ui->stopButton, SIGNAL(pressed()), this, SLOT(stopPrototype()));
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::startPrototype() {
ui->startButton->setEnabled(false);
ui->label_screenshot->hide();
container->setMinimumSize(600, 600);
ui->gridLayout->addWidget(container,1,1);
myProcess->setWorkingDirectory("../../simpleX11Embed/build");
myProcess
->start
("./simpleX11Embed",
QStringList() <<
"-into" <<
QString().
setNum(container
->winId
()));
ui->stopButton->setEnabled(true);
connect(myProcess, SIGNAL(finished(int)), this, SLOT(enableStartButton()));
}
void MainWindow::stopPrototype() {
myProcess->close();
}
void MainWindow::enableStartButton() {
container->close();
ui->label_screenshot->show();
ui->stopButton->setEnabled(false);
ui->startButton->setEnabled(true);
}
int main(int argc, char *argv[])
{
MainWindow w;
w.show();
return a.exec();
}
#include "mainwindow.h"
MainWindow::MainWindow(QWidget *parent) : QWidget(parent), ui(new Ui::Prototype_tab)
{
showMaximized();
ui->setupUi(this);
connect(ui->startButton, SIGNAL(pressed()), this, SLOT(startPrototype()));
connect(ui->stopButton, SIGNAL(pressed()), this, SLOT(stopPrototype()));
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::startPrototype() {
ui->startButton->setEnabled(false);
ui->label_screenshot->hide();
container = new QX11EmbedContainer(ui->tabWidget);
container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
container->setMinimumSize(600, 600);
ui->gridLayout->addWidget(container,1,1);
myProcess = new QProcess(container);
myProcess->setWorkingDirectory("../../simpleX11Embed/build");
myProcess->start("./simpleX11Embed", QStringList() << "-into" << QString().setNum(container->winId()));
ui->stopButton->setEnabled(true);
connect(myProcess, SIGNAL(finished(int)), this, SLOT(enableStartButton()));
}
void MainWindow::stopPrototype() {
myProcess->close();
}
void MainWindow::enableStartButton() {
container->close();
ui->label_screenshot->show();
ui->stopButton->setEnabled(false);
ui->startButton->setEnabled(true);
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
#include "simpleX11Embed.h"
textBrowser->setFocusPolicy(Qt::StrongFocus);
widlayout->addWidget(textBrowser);
}
int main(int argc, char *argv[]){
if(app.arguments().count() > 2)
if (app.arguments()[1] == "-into") {
QString windowId
(app.
arguments()[2]);
MainWindow window;
window.embedInto(windowId.toULong());
window.show();
return app.exec();
}
MainWindow w;
w.show();
return app.exec();
}
#include "simpleX11Embed.h"
MainWindow::MainWindow(QWidget *parent) : QX11EmbedWidget(parent) {
QTextEdit *textBrowser = new QTextEdit();
textBrowser->setFocusPolicy(Qt::StrongFocus);
textBrowser->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QVBoxLayout *widlayout = new QVBoxLayout(this);
widlayout->addWidget(textBrowser);
}
int main(int argc, char *argv[]){
QApplication app(argc, argv);
if(app.arguments().count() > 2)
if (app.arguments()[1] == "-into") {
QString windowId(app.arguments()[2]);
MainWindow window;
window.embedInto(windowId.toULong());
window.show();
return app.exec();
}
MainWindow w;
w.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks