본문 바로가기

IT/QT

QSpinBox Set Input Font

http://www.codeprogress.com/cpp/libraries/qt/showQtExample.php?index=186&key=QSpinBoxTextSize


1
2
3
4
5
6
7
8
9
10
11
12
13
#include "widget.h"
#include <QApplication>
 
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Widget w;
    w.show();
 
    return a.exec();
}
 
 
cs


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef WIDGET_H
#define WIDGET_H
 
#include <QWidget>
#include <QSpinBox>
#include <QHBoxLayout>
 
class Widget : public QWidget
{
    Q_OBJECT
 
public:
    Widget(QWidget *parent = 0);
    ~Widget();
 
private:
    QSpinBox    *mySpinBox;
};
 
#endif // WIDGET_H
 
 
cs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "widget.h"
 
Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
    mySpinBox = new QSpinBox(this);
 
    mySpinBox->setWindowTitle("QSpin Box Test");
    mySpinBox->setFixedSize(15050);
 
    QFont    *font = new QFont();
    font->setBold(true);
    font->setPixelSize(25);
 
    mySpinBox->setFont(*font);
    mySpinBox->show();
 
}
 
Widget::~Widget()
{
 
}
 
 
cs





반응형