Turecko-americká vycházející matematická hvězda Levent Alpöge ze společnosti Anthropic vyvolal pozdvižení oznámením (PDF), že s pomocí superinteligence Claude od Antropicu dokázal vyřešit jeden ze sedmi největších matematických problémů tisíciletí, slavnou Riemannovu hypotézu (prvočísla se mezi čísly objevují zdánlivě nepravidelně, hypotéza tvrdí, že za jejich rozmístěním je určitý řád). Svůj důkaz uvolnil jako open-source
… více »
//protected variables in header file:
QWidget *dialog_err;
QLabel *text;
QDialogButtonBox *button;
QDesktopWidget *desktop;
//////////////////////////////////////////////////////
//cpp file:
#include "DialogErrorClass.h"
DialogErrorClass::DialogErrorClass( QWidget *parent ) : QWidget(parent) {
desktop = QApplication::desktop();
// create window
dialog_err = new QWidget;
dialog_err->setObjectName( QString::fromUtf8( "DialogError" ) );
dialog_err->move( ( ( desktop->width() - 420 ) / 2 ), ( ( desktop->height() - 93 ) / 2 ) );
dialog_err->setWindowTitle( QApplication::translate( "DialogError", "Chyba programu", 0, QApplication::UnicodeUTF8 ) );
//label text error message
text = new QLabel( dialog_err );
text->setObjectName( QString::fromUtf8( "errorMsg" ) );
text->setGeometry( QRect( 10, 10, 400, 21 ) );
text->setStyleSheet(QString::fromUtf8("align: right;"));
// close button
button = new QDialogButtonBox( QDialogButtonBox::Cancel, Qt::Horizontal, dialog_err );
button->setObjectName( QString::fromUtf8( "closeButton" ) );
button->setGeometry( QRect( 169, 51, 81, 32 ) );
}
void DialogErrorClass::setMessage( const char *msg ) {
text->setText( QApplication::translate( "errorMsg", (char*)msg, 0, QApplication::UnicodeUTF8 ) );
}
void DialogErrorClass::show() {
connect( button, SIGNAL( accepted() ), qApp, SLOT( quit() ) );
dialog_err->show();
}
Řešení dotazu:
button obsahuje len tlacidlo QDialogButtonBox::Cancel, ktore emituje len signal rejected (nie accepted).
Toto by uz mohlo fungovat:
connect( button, SIGNAL( rejected() ), qApp, SLOT( quit() ) );
Tiskni
Sdílej: