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

📄 detail.cpp

📁 linux窗口程序设计一书的第三章代码-对话框进阶,希望对大家有用
💻 CPP
字号:
#include <QTextCodec>
#include <QLayout>
#include "detail.h"

Detail::Detail(QWidget *parent, Qt::WindowFlags f1)
	: QWidget(parent,f1)
{
    label1 = new QLabel(tr("Country/Zone:"));    label2 = new QLabel(tr("Province:"));    label3 = new QLabel(tr("City:"));    label4 = new QLabel(tr("Discription:"));
    
    comboBoxCountry = new QComboBox();
    comboBoxCountry->insertItem(0,tr("China"));
    
    comboBoxProvince = new QComboBox();
    comboBoxProvince->insertItem(0,tr("JiangSu"));
    
    lineeditCity = new QLineEdit();
    texteditPriv = new QTextEdit();
    
    QGridLayout *mainLayout = new QGridLayout(this);
    int labelCol = 0;
    int contCol = 1;
    mainLayout->addWidget(label1,0,labelCol);
    mainLayout->addWidget(comboBoxCountry,0,contCol);
    mainLayout->addWidget(label2,1,labelCol);
    mainLayout->addWidget(comboBoxProvince,1,contCol);
    mainLayout->addWidget(label3,2,labelCol);
    mainLayout->addWidget(lineeditCity,2,contCol);
    mainLayout->addWidget(label4,3,labelCol,Qt::AlignTop);
    mainLayout->addWidget(texteditPriv,3,contCol);
    mainLayout->setColumnStretch(0,10);
    mainLayout->setColumnStretch(1,30);

    mainLayout->setMargin(20);
    mainLayout->setSpacing(25);
}

⌨️ 快捷键说明

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