From 1969804ac3ae69f43ade5c40657954442e0916c2 Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Sun, 2 Dec 2012 21:24:05 -0600 Subject: [PATCH] Added some extra keys to aid in dismissal of About dialog. --- src/about.cpp | 51 ++++++++++++++------------------------------------- src/about.h | 23 ++++------------------- 2 files changed, 18 insertions(+), 56 deletions(-) diff --git a/src/about.cpp b/src/about.cpp index a09924f..95e5275 100644 --- a/src/about.cpp +++ b/src/about.cpp @@ -23,49 +23,18 @@ AboutWindow::AboutWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog) setWindowTitle(tr("About Architektonas...")); layout = new QVBoxLayout(); - layout->setSizeConstraint(QLayout::SetFixedSize); +// layout->setSizeConstraint(QLayout::SetFixedSize); setLayout(layout); -// image = new QLabel(); -// image->setAlignment(Qt::AlignRight); -// image->setPixmap(QPixmap(":/res/atns-icon.png")); -// layout->addWidget(image); - -#if 0 -// QString s = QString(tr("(Last full build was on %1 %2)
")).arg(__DATE__).arg(__TIME__); - QString s = QString(tr(""//"//)); -// s.append(tr( -//"This is some random text. I wonder if it will be rendered correctly or not???

" - "" - "
" - "" - "" - "" - "" - "" - "" -// "" - "" - "
Architektonas: Free, Industrial Strength 2D Computer Aided Design
Version: 1.0.0
License: GPL v3 or later
Chief Architect: James L. Hammons (shamus)
Coders: James L. Hammons (shamus)
Testers: shamus
Homepage: http://shamusworld.gotdns.org/architektonas/
" - "
" - "

" - "The authors of Architektonas would like to express their heartfelt gratitude to:" -// "
" - "" - )); -#else QString s = QString(tr( "" "" - "" + "" "" "
" +// "" + "" -// "" - "" + "" "" "" "" @@ -73,6 +42,7 @@ AboutWindow::AboutWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog) // "" "" "
Architektonas: Free, Industrial Strength 2D Computer Aided Design
Architektonas: Free, Industrial Strength 2D Computer Aided Design
Architektonas: Free, Industrial Strength 2D Computer Aided Design
Version: 1.0.0
License: GPL v3 or later
Chief Architect: James Hammons (shamus)
Testers: shamus
Homepage: http://shamusworld.gotdns.org/architektonas/
" + "

" "The authors of Architektonas would like to express their heartfelt gratitude to:" "
    " @@ -84,7 +54,6 @@ AboutWindow::AboutWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog) "
" )); -#endif text = new QLabel(s); text->setWordWrap(true); @@ -92,3 +61,11 @@ AboutWindow::AboutWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog) // text->setMaximumWidth(800); layout->addWidget(text); } + + +void AboutWindow::keyPressEvent(QKeyEvent * e) +{ + if (e->key() == Qt::Key_Escape || e->key() == Qt::Key_Return) + hide(); +} + diff --git a/src/about.h b/src/about.h index 7397e3b..1eceedb 100644 --- a/src/about.h +++ b/src/about.h @@ -2,7 +2,7 @@ // about.h: Credits where credits are due ;-) // // by James L. Hammons -// (C) 2010 Underground Software +// (C) 2012 Underground Software // #ifndef __ABOUT_H__ @@ -15,6 +15,9 @@ class AboutWindow: public QWidget public: AboutWindow(QWidget * parent = 0); + protected: + void keyPressEvent(QKeyEvent *); + private: QVBoxLayout * layout; QLabel * text; @@ -22,21 +25,3 @@ class AboutWindow: public QWidget }; #endif // __ABOUT_H__ - - -#if 0 -class AboutWindow : public QbWindow { - Q_OBJECT - -public: - QVBoxLayout *layout; - struct Logo : public QWidget { - void paintEvent(QPaintEvent*); - } *logo; - QLabel *info; - - AboutWindow(); -}; - -extern AboutWindow *aboutWindow; -#endif -- 2.37.2