⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aboutwindow.cc

📁 c++的guiQt做的开发
💻 CC
字号:
/** @file AboutWindow - class representing about window. Display author(s), application name and version. @author Martin Petricek*/#include "aboutwindow.h"#include "image.h"#include <qlayout.h>#include <qframe.h>#include <qlabel.h>#include <qpushbutton.h>#include <QPixmap>#include <QGridLayout>#include "version.h"#include "util.h"#include "iconcache.h"namespace gui {using namespace std;/** Version of program */QString app=APP_NAME " " VERSION;/** About Dialog flags */const Qt::WindowFlags aboutDialogFlags=Qt::Dialog;/** constructor of AboutWindow, creates window and fills it with elements, parameters are ignored @param parent Parent window of this dialog */AboutWindow::AboutWindow(QWidget *parent/*=0*/):QWidget(parent,aboutDialogFlags) { QWidget::setAttribute(Qt::WA_DeleteOnClose); IconCache ic; //Window title setWindowTitle(app+" - "+tr("About program")); QGridLayout *l=new QGridLayout(this); l->setSpacing(0); l->setMargin(0); //Text in about window QString info=QString("<big>")+tr("Image viewer and manipulator")+"</big><br><b>"+tr("Homepage")+"</b> : http://mpview.sourceforge.net/"; QString authors=QString("<b>")+tr("Author")+QString::fromUtf8("</b> : Martin Petříček<br>"); QLabel *lb=new QLabel(QString("<table><tr><td valign=\"top\"><h1>")+app+"</h1><br>"+info+"<br>"+authors+"<br>"+tr("Compiled")+": "+COMPILE_TIME+  +"<br>"+tr("Using Qt version %1").arg(qVersion())+", "+tr("CImg version %1").arg(Image::cimgVersion())+  "</td></tr><tr><td>"+tr("This program is distributed under terms of GNU GPL")+  "<br><br><small>"+Image::cimgInfo()+"</small></td></tr></table>", this); lb->setTextFormat(Qt::RichText); //Lower frame with Ok button QFrame *okFrame=new QFrame(this); QGridLayout *lFrame=new QGridLayout(okFrame); lFrame->setMargin(5); QPushButton *ok=new QPushButton(QObject::tr("&Ok"), okFrame); lFrame->addWidget(ok,0,1); QObject::connect(ok, SIGNAL(clicked()), this, SLOT(close())); //Logo on right QLabel* logo=new QLabel(this); QPixmap* logoImage=ic.getIcon("app_logo.png"); QSize imageSize; QSize bgSize; if (logoImage) {  QPalette paletteLogo;  paletteLogo.setBrush(logo->backgroundRole(),QBrush(0xffffff));  logo->setPalette(paletteLogo);  logo->setAutoFillBackground(true);  logo->setPixmap(*logoImage);  imageSize=logoImage->size();  logo->setMinimumSize(imageSize);  logo->setMaximumWidth(imageSize.width()); } //Background of text QPixmap* bgImage=ic.getIcon("app_bg.png"); if (bgImage) {  QPalette paletteBg;  paletteBg.setBrush(lb->backgroundRole(),QBrush(*bgImage));  lb->setPalette(paletteBg);  lb->setAutoFillBackground(true);  bgSize=bgImage->size();  lb->setMaximumSize(bgSize); } okFrame->setFixedHeight(10+ok->sizeHint().height()); if (bgImage!=NULL && logoImage!=NULL) {  bgSize.setWidth(bgSize.width()+imageSize.width());  bgSize.setHeight(bgSize.height()+10+ok->sizeHint().height());  setMinimumSize(imageSize);  setMaximumSize(bgSize);  setMinimumHeight(10+ok->sizeHint().height()+imageSize.height()); } l->addWidget(lb,0,0); l->addWidget(logo,0,1); l->addWidget(okFrame,1,0,1,2); ok->show(); lb->show();}/** default destructor */AboutWindow::~AboutWindow() {}} // namespace gui

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -