forminfo.cpp

来自「强大的QT,GTK的学习Demo.包含DSP驱动以及所使用库文件资源。」· C++ 代码 · 共 55 行

CPP
55
字号


#include "forminfo.h"

#include <qvariant.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>

/*
 * Constructs a FormInfo as a child of 'parent', with the name 'name' and widget
 * flags set to 'f'.
 */
FormInfo::FormInfo(QWidget * parent, const char *name, WFlags fl) :
    QWidget(parent, name, fl)
{
    if(!name)
        setName("FormInfo");

    textLabel = new QLabel(this, "textLabel");
    textLabel->setGeometry(QRect(20, 20, 180, 31));

    pushButton = new QPushButton(this, "pushButton");
    pushButton->setGeometry(QRect(50, 70, 110, 29));
    languageChange();
    resize(QSize(212, 114).expandedTo(minimumSizeHint()));
    connect(pushButton, SIGNAL(clicked()), this, SLOT(close()));
}

/*
 =======================================================================================================================
 * Destroys the object and frees any allocated resources
 =======================================================================================================================
 */
FormInfo::~FormInfo()
{
    /* no need to delete child widgets, Qt does it all for us */
}

/*
 =======================================================================================================================
 * Sets the strings of the subwidgets using the current language.
 =======================================================================================================================
 */
void FormInfo::languageChange()
{
    setCaption(tr("Information"));
    textLabel->setText(tr("The Space of disk isn't enough!\n    Begin overwrite files!"));
    pushButton->setText(tr("OK"));
}

⌨️ 快捷键说明

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