keyboard +/- 는 1씩 증가 PgUp / PgDn 은 10씩 증가
.h
#pragma once
#include <QtWidgets/QDialog>
#include "ui_QtWidgetsApp.h"
#include <QString>
class QtWidgetsApp_1 : public QDialog
{
Q_OBJECT
public:
QtWidgetsApp_1(QWidget *parent = Q_NULLPTR);
private:
Ui::QtWidgetsApp_1Class ui;
public slots:
void btn_run_clicked();
};
- spinbox값을 label에 표시하기 위한 명령어
ui.lbl_age->setText(ui.spinbox_age->cleanText()); |
.cpp
#include "QtWidgetsApp.h"
QtWidgetsApp_1::QtWidgetsApp_1(QWidget *parent) : QDialog(parent)
{
ui.setupUi(this);
connect(ui.btn_run, SIGNAL(clicked()), this, SLOT(btn_run_clicked()));
}
// 버튼 1
void QtWidgetsApp_1::btn_run_clicked()
{
QString str;
str.append(QString::fromLocal8Bit("당신의 나이는 "));
//str.append(" \n");
str.append(QString("%1").arg(ui.spinbox->cleanText()));
str.append(QString::fromLocal8Bit("살 입니다."));
ui.lbl_age->setText(str);
}
'PROGRAM > Qt with C++' 카테고리의 다른 글
Qt - Checkbox (0) | 2021.06.21 |
---|---|
Qt - RadioButton (0) | 2021.06.21 |
Qt - VisualStudio 2019 한글깨짐 (0) | 2021.06.21 |
Qt - Combobox (0) | 2021.06.18 |
Qt - PushButton (0) | 2021.06.18 |