本文整理汇总了C++中QPushButton::connect方法的典型用法代码示例。如果您正苦于以下问题:C++ QPushButton::connect方法的具体用法?C++ QPushButton::connect怎么用?C++ QPushButton::connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPushButton
的用法示例。
在下文中一共展示了QPushButton::connect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QPushButton
//! [9]
QPushButton *Screenshot::createButton(const QString &text, QWidget *receiver,
const char *member)
{
QPushButton *button = new QPushButton(text);
button->connect(button, SIGNAL(clicked()), receiver, member);
return button;
}
示例2: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QDialog w;
w.setWindowTitle("Reboot into:");
QVBoxLayout layout;
efi_init();
reboot_init();
uint16_t *data;
int l = boot_entry_list(&data);
for (int i = 0; i < l; i++) {
QPushButton *button = new QPushButton(QString(boot_entry_name(data[i])));
layout.addWidget(button);
button->connect(button, &QPushButton::clicked, [=]() {
set_boot_next(data[i]);
do_reboot();
});
}
w.setLayout(&layout);
w.show();
return a.exec();
}
示例3: logToConsole
void DevConsole::logToConsole(const QString &logText, const QString &channel, bool raise)
{
QString target_channel = channel;
if(channel == "System") //Prevent creation another "system" tab if switched another UI language
target_channel = ui->tabWidget->tabText(0);
for(int i = 0; i < ui->tabWidget->count(); ++i)
{
if(ui->tabWidget->tabText(i) == target_channel)
{
QPlainTextEdit *tarEdit = getEditByIndex(i);
if(!tarEdit)
return;
tarEdit->appendPlainText(logText);
tarEdit->verticalScrollBar()->setValue(tarEdit->verticalScrollBar()->maximum());
if(raise) ui->tabWidget->setCurrentIndex(i);
return;
}
}
//create new channel
QWidget *w = new QWidget();
QGridLayout *l = new QGridLayout(w);
l->setContentsMargins(0, 0, 0, 0);
l->setSpacing(0);
QPlainTextEdit *e = new QPlainTextEdit(w);
l->addWidget(e, 0, 0, 1, 1);
QPushButton *p = new QPushButton(w);
l->addWidget(p, 1, 0, 1, 1);
p->setFlat(true);
p->connect(p, SIGNAL(clicked()), this, SLOT(clearCurrentLog()));
p->setText(tr("Clear %1 Log").arg(target_channel));
e->setReadOnly(true);
e->setStyleSheet(ui->plainTextEdit->styleSheet());
e->setFont(ui->plainTextEdit->font());
e->appendPlainText(logText);
e->verticalScrollBar()->setValue(e->verticalScrollBar()->maximum());
ui->tabWidget->addTab(w, target_channel);
}
示例4: main
int main(int argc, char **argv)
{
QString fileName{ "C:/develop/$sync/GFZ/data/VTK XML data/Volcano 2 topo.vtp" };
auto data = Loader::readFile(fileName);
QApplication app(argc, argv);
QMainWindow window;
window.show();
DataSetHandler dataSetHandler;
DataMapping dataMapping(dataSetHandler);
RenderView renderView(dataMapping, -1);
window.addDockWidget(Qt::TopDockWidgetArea, renderView.dockWidgetParent());
app.setActiveWindow(&renderView);
RenderConfigWidget renderConfig;
renderConfig.setCurrentRenderView(&renderView);
renderConfig.show();
RendererConfigWidget rendererConfig;
rendererConfig.setCurrentRenderView(&renderView);
rendererConfig.show();
ColorMappingChooser colorMapping;
colorMapping.setCurrentRenderView(&renderView);
colorMapping.show();
GlyphMappingChooser glyphs;
glyphs.setCurrentRenderView(&renderView);
glyphs.show();
QPushButton button;
button.connect(&button, &QPushButton::clicked, [&renderView, &data] (){
QList<DataObject *> incomp;
renderView.showDataObjects({ data.get() }, incomp);
});
button.show();
QPushButton exitButton("quit");
exitButton.connect(&exitButton, &QPushButton::clicked, &app, &QApplication::quit);
exitButton.show();
return app.exec();
/*auto renderer = vtkSmartPointer<vtkRenderer>::New();
renderer->SetBackground(0.7, 0.7, 0.7);
QScopedPointer<RenderedData> rendered{ data->createRendered() };
rendered->viewProps()->InitTraversal();
while (auto && it = rendered->viewProps()->GetNextProp())
{
renderer->AddViewProp(it);
}
auto renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
auto rwInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();
rwInteractor->SetRenderWindow(renderWindow);
rwInteractor->Start();
return 0;*/
}