QtSDKとqrencodeを使ったQRコード画像生成
Revision | 89f85ae7b7f2dab6aea042b754cb8b32478df551 (tree) |
---|---|
Zeit | 2012-10-25 23:10:35 |
Autor | arakaki <alucky4416@user...> |
Commiter | arakaki |
CHG: Refactoring. git autocrlf off.
@@ -1,190 +1,198 @@ | ||
1 | -#include "mainwindow.h" | |
2 | -#include "ui_mainwindow.h" | |
3 | - | |
4 | -#include <QFileDialog> | |
5 | -#include <QMessageBox> | |
6 | -#include <QTextCodec> | |
7 | -#include <QClipboard> | |
8 | - | |
9 | -#include <QDebug> | |
10 | - | |
11 | -MainWindow::MainWindow(QWidget *parent) : | |
12 | - QMainWindow(parent), | |
13 | - ui(new Ui::MainWindow) | |
14 | -{ | |
15 | - ui->setupUi(this); | |
16 | - | |
17 | - image = NULL; | |
18 | - ui->imgView->setScene(&scene); | |
19 | - | |
20 | - ui->lineEdit->setText(""); | |
21 | - ui->lineEdit->setFocus(); | |
22 | - ui->btnStart->setDisabled(true); | |
23 | -} | |
24 | - | |
25 | -MainWindow::~MainWindow() | |
26 | -{ | |
27 | - delete ui; | |
28 | -} | |
29 | - | |
30 | -QRcode *MainWindow::encode(const unsigned char *intext, int length, QRecLevel level = QR_ECLEVEL_L) | |
31 | -{ | |
32 | - QRcode *code; | |
33 | - | |
34 | -// int casesensitive = 1; | |
35 | - int version = 0; | |
36 | -// QRecLevel level = QR_ECLEVEL_L; | |
37 | -// QRencodeMode hint = QR_MODE_8; | |
38 | - | |
39 | -// if(micro) { | |
40 | -// if(eightbit) { | |
41 | -// code = QRcode_encodeDataMQR(length, intext, version, level); | |
42 | -// } else { | |
43 | -// code = QRcode_encodeStringMQR((char *)intext, version, level, hint, casesensitive); | |
44 | -// } | |
45 | -// } else { | |
46 | -// if(eightbit) { | |
47 | - code = QRcode_encodeData(length, intext, version, level); | |
48 | -// } else { | |
49 | -// code = QRcode_encodeString((char *)intext, version, level, hint, casesensitive); | |
50 | -// } | |
51 | -// } | |
52 | - | |
53 | - return code; | |
54 | -} | |
55 | - | |
56 | -QPixmap MainWindow::encodeTextToPixmap( QString text, int size = 3, int margin = 3 ) | |
57 | -{ | |
58 | -// int margin = 3; | |
59 | -// int size = 3; | |
60 | - | |
61 | -#if 0 | |
62 | - QByteArray a = text.toUtf8(); | |
63 | - if ( m_useBom ) | |
64 | - { | |
65 | - // insert BOM | |
66 | - a.insert( 0, BOM ); | |
67 | - } | |
68 | -#else | |
69 | - QTextCodec* sjisCodec = QTextCodec::codecForName( "SJIS" ); // should be ShiftJIS for Japanese MobilePhone. | |
70 | - QByteArray a = sjisCodec->fromUnicode( text ); | |
71 | -#endif | |
72 | - QRecLevel level; | |
73 | - switch(ui->comboBox_ErrCrctLevel->currentIndex()) { | |
74 | - case 0: | |
75 | - level = QR_ECLEVEL_L; | |
76 | - break; | |
77 | - case 1: | |
78 | - level = QR_ECLEVEL_M; | |
79 | - break; | |
80 | - case 2: | |
81 | - level = QR_ECLEVEL_Q; | |
82 | - break; | |
83 | - case 3: | |
84 | - level = QR_ECLEVEL_H; | |
85 | - break; | |
86 | - default: | |
87 | - break; | |
88 | - } | |
89 | - | |
90 | - QRcode* qrcode = encode( (unsigned char*)a.constData(), a.length(), level); // Generate QRCode from string. | |
91 | - if ( qrcode == NULL ) | |
92 | - { | |
93 | - return NULL; | |
94 | - } | |
95 | - | |
96 | - int realwidth = (qrcode->width + margin * 2) * size; | |
97 | - if (image != NULL) { | |
98 | - delete(image); | |
99 | - } | |
100 | - image = new QImage( realwidth, realwidth, QImage::Format_Mono ); | |
101 | - QPainter painter(image); | |
102 | - | |
103 | - painter.fillRect( QRect( 0, 0, realwidth, realwidth ), QColor( Qt::white ) ); | |
104 | - | |
105 | - QColor black( Qt::black ); | |
106 | - | |
107 | - int i = 0; | |
108 | - int x = 0; | |
109 | - int y = 0; | |
110 | - QRect rect( 0, 0, size, size ); | |
111 | - while ( y < qrcode->width ) | |
112 | - { | |
113 | - x = 0; | |
114 | - while ( x < qrcode->width ) | |
115 | - { | |
116 | - // only if a block is present (black) | |
117 | - if ( qrcode->data[i] & 1 ) | |
118 | - { | |
119 | - rect.moveTo(size * (margin + x), | |
120 | - size * (margin + y)); | |
121 | - painter.fillRect( rect, black ); | |
122 | - } | |
123 | - i++; | |
124 | - x++; | |
125 | - } | |
126 | - y++; | |
127 | - } | |
128 | - | |
129 | - painter.end(); | |
130 | - | |
131 | - QPixmap pixmap = QPixmap::fromImage(*image); | |
132 | - | |
133 | - QRcode_free(qrcode); | |
134 | - | |
135 | - return pixmap; | |
136 | -} | |
137 | - | |
138 | -void MainWindow::on_btnStart_clicked() | |
139 | -{ | |
140 | - | |
141 | - scene.clear(); | |
142 | - QPixmap pixmap = encodeTextToPixmap(ui->lineEdit->text(), ui->spinBox_size->value(), ui->spinBox_margin->value()); | |
143 | - scene.addPixmap( pixmap ); | |
144 | - | |
145 | -} | |
146 | - | |
147 | -void MainWindow::on_lineEdit_textChanged(const QString &arg1) | |
148 | -{ | |
149 | - if (arg1.isEmpty()) { | |
150 | - ui->btnStart->setDisabled(true);; | |
151 | - } else { | |
152 | - ui->btnStart->setDisabled(false); | |
153 | - } | |
154 | -} | |
155 | - | |
156 | -void MainWindow::on_actionExit_triggered() | |
157 | -{ | |
158 | - close(); | |
159 | -} | |
160 | - | |
161 | -void MainWindow::on_actionSave_triggered() | |
162 | -{ | |
163 | - if (image == NULL || image->isNull()) { | |
164 | - ; // empty imagedata | |
165 | - } else { | |
166 | - QString fileName = QFileDialog::getSaveFileName( this, "Save Image", "./", "Image Files (*.png)" ); | |
167 | - if ( fileName.isEmpty() ) return; | |
168 | - image->save( fileName, "PNG"); | |
169 | - } | |
170 | -} | |
171 | - | |
172 | -void MainWindow::on_actionToClibboard_triggered() | |
173 | -{ | |
174 | - if (image == NULL || image->isNull()) { | |
175 | - ; | |
176 | - } else { | |
177 | - QClipboard *clipboard = QApplication::clipboard(); | |
178 | - clipboard->setImage(*image); | |
179 | - } | |
180 | -} | |
181 | - | |
182 | -void MainWindow::on_actionAbout_triggered() | |
183 | -{ | |
184 | - QMessageBox::about(this, "About", tr("QtQREncode v0.1, uses qrencode library.")); | |
185 | -} | |
186 | - | |
187 | -void MainWindow::on_actionAbout_Qt_triggered() | |
188 | -{ | |
189 | - QApplication::aboutQt(); | |
190 | -} | |
1 | +#include "mainwindow.h" | |
2 | +#include "ui_mainwindow.h" | |
3 | + | |
4 | +#include <QFileDialog> | |
5 | +#include <QMessageBox> | |
6 | +#include <QTextCodec> | |
7 | +#include <QClipboard> | |
8 | + | |
9 | +#include <QDebug> | |
10 | + | |
11 | +MainWindow::MainWindow(QWidget *parent) : | |
12 | + QMainWindow(parent), | |
13 | + ui(new Ui::MainWindow) | |
14 | +{ | |
15 | + ui->setupUi(this); | |
16 | + | |
17 | + image = NULL; | |
18 | + ui->imgView->setScene(&scene); | |
19 | + | |
20 | + ui->lineEdit->setText(""); | |
21 | + ui->lineEdit->setFocus(); | |
22 | + ui->btnStart->setDisabled(true); | |
23 | +} | |
24 | + | |
25 | +MainWindow::~MainWindow() | |
26 | +{ | |
27 | + if (image != NULL) delete image; | |
28 | + | |
29 | + delete ui; | |
30 | +} | |
31 | + | |
32 | +QRcode *MainWindow::encode(const unsigned char *intext, int length, QRecLevel level = QR_ECLEVEL_L) | |
33 | +{ | |
34 | + QRcode *code; | |
35 | + | |
36 | +// int casesensitive = 1; | |
37 | + int version = 0; | |
38 | +// QRecLevel level = QR_ECLEVEL_L; | |
39 | +// QRencodeMode hint = QR_MODE_8; | |
40 | + | |
41 | +// if(micro) { | |
42 | +// if(eightbit) { | |
43 | +// code = QRcode_encodeDataMQR(length, intext, version, level); | |
44 | +// } else { | |
45 | +// code = QRcode_encodeStringMQR((char *)intext, version, level, hint, casesensitive); | |
46 | +// } | |
47 | +// } else { | |
48 | +// if(eightbit) { | |
49 | + code = QRcode_encodeData(length, intext, version, level); | |
50 | +// } else { | |
51 | +// code = QRcode_encodeString((char *)intext, version, level, hint, casesensitive); | |
52 | +// } | |
53 | +// } | |
54 | + | |
55 | + return code; | |
56 | +} | |
57 | + | |
58 | +QPixmap MainWindow::encodeTextToPixmap( QString text, int size = 3, int margin = 3, int ErrCLevel = 0 ) | |
59 | +{ | |
60 | +// int margin = 3; | |
61 | +// int size = 3; | |
62 | + | |
63 | +#if 0 | |
64 | + QByteArray a = text.toUtf8(); | |
65 | + if ( m_useBom ) | |
66 | + { | |
67 | + // insert BOM | |
68 | + a.insert( 0, BOM ); | |
69 | + } | |
70 | +#else | |
71 | + QTextCodec* sjisCodec = QTextCodec::codecForName( "SJIS" ); // should be ShiftJIS for Japanese MobilePhone. | |
72 | + QByteArray a = sjisCodec->fromUnicode( text ); | |
73 | +#endif | |
74 | + QRecLevel level; | |
75 | + switch(ErrCLevel) { | |
76 | + case 0: | |
77 | + level = QR_ECLEVEL_L; | |
78 | + break; | |
79 | + case 1: | |
80 | + level = QR_ECLEVEL_M; | |
81 | + break; | |
82 | + case 2: | |
83 | + level = QR_ECLEVEL_Q; | |
84 | + break; | |
85 | + case 3: | |
86 | + level = QR_ECLEVEL_H; | |
87 | + break; | |
88 | + default: | |
89 | + break; | |
90 | + } | |
91 | + | |
92 | + QRcode* qrcode = encode( (unsigned char*)a.constData(), a.length(), level); // Generate QRCode from string. | |
93 | + if ( qrcode == NULL ) { | |
94 | + return NULL; | |
95 | + } | |
96 | + if (qrcode->width < 21 || qrcode->width > 177) { // qrcode width range is min is "ver-1 = 21 cell", max is ver-40 = 177 cell | |
97 | + return NULL; | |
98 | + } | |
99 | + | |
100 | + int realwidth = (qrcode->width + margin * 2) * size; | |
101 | + | |
102 | + if (image != NULL) { | |
103 | + delete(image); | |
104 | + } | |
105 | + image = new QImage( realwidth, realwidth, QImage::Format_Mono ); | |
106 | + QPainter painter(image); | |
107 | + | |
108 | + painter.fillRect( QRect( 0, 0, realwidth, realwidth ), QColor( Qt::white ) ); | |
109 | + | |
110 | + QColor black( Qt::black ); | |
111 | + | |
112 | + int i = 0; | |
113 | + int x = 0; | |
114 | + int y = 0; | |
115 | + QRect rect( 0, 0, size, size ); | |
116 | + while ( y < qrcode->width ) | |
117 | + { | |
118 | + x = 0; | |
119 | + while ( x < qrcode->width ) | |
120 | + { | |
121 | + // only if a block is present (black) | |
122 | + if ( qrcode->data[i] & 1 ) | |
123 | + { | |
124 | + rect.moveTo(size * (margin + x), | |
125 | + size * (margin + y)); | |
126 | + painter.fillRect( rect, black ); | |
127 | + } | |
128 | + i++; | |
129 | + x++; | |
130 | + } | |
131 | + y++; | |
132 | + } | |
133 | + | |
134 | + painter.end(); | |
135 | + | |
136 | + QPixmap pixmap = QPixmap::fromImage(*image); | |
137 | + | |
138 | + QRcode_free(qrcode); | |
139 | + | |
140 | + return pixmap; | |
141 | +} | |
142 | + | |
143 | +void MainWindow::on_btnStart_clicked() | |
144 | +{ | |
145 | + | |
146 | + scene.clear(); | |
147 | + QPixmap pixmap = encodeTextToPixmap(ui->lineEdit->text(), | |
148 | + ui->spinBox_size->value(), | |
149 | + ui->spinBox_margin->value(), | |
150 | + ui->comboBox_ErrCrctLevel->currentIndex()); | |
151 | + scene.addPixmap( pixmap ); | |
152 | + | |
153 | +} | |
154 | + | |
155 | +void MainWindow::on_lineEdit_textChanged(const QString &arg1) | |
156 | +{ | |
157 | + if (arg1.isEmpty()) { | |
158 | + ui->btnStart->setDisabled(true);; | |
159 | + } else { | |
160 | + ui->btnStart->setDisabled(false); | |
161 | + } | |
162 | +} | |
163 | + | |
164 | +void MainWindow::on_actionExit_triggered() | |
165 | +{ | |
166 | + close(); | |
167 | +} | |
168 | + | |
169 | +void MainWindow::on_actionSave_triggered() | |
170 | +{ | |
171 | + if (image == NULL || image->isNull()) { | |
172 | + ; // empty imagedata | |
173 | + } else { | |
174 | + QString fileName = QFileDialog::getSaveFileName( this, "Save Image", "./", "Image Files (*.png)" ); | |
175 | + if ( fileName.isEmpty() ) return; | |
176 | + image->save( fileName, "PNG"); | |
177 | + } | |
178 | +} | |
179 | + | |
180 | +void MainWindow::on_actionToClibboard_triggered() | |
181 | +{ | |
182 | + if (image == NULL || image->isNull()) { | |
183 | + ; | |
184 | + } else { | |
185 | + QClipboard *clipboard = QApplication::clipboard(); | |
186 | + clipboard->setImage(*image); | |
187 | + } | |
188 | +} | |
189 | + | |
190 | +void MainWindow::on_actionAbout_triggered() | |
191 | +{ | |
192 | + QMessageBox::about(this, "About", tr("QtQREncode v0.1, uses qrencode library.")); | |
193 | +} | |
194 | + | |
195 | +void MainWindow::on_actionAbout_Qt_triggered() | |
196 | +{ | |
197 | + QApplication::aboutQt(); | |
198 | +} |
@@ -1,50 +1,48 @@ | ||
1 | -#ifndef MAINWINDOW_H | |
2 | -#define MAINWINDOW_H | |
3 | - | |
4 | -#include <QMainWindow> | |
5 | - | |
6 | -#include <QGraphicsView> | |
7 | - | |
8 | -#include <qrencode.h> | |
9 | - | |
10 | -namespace Ui { | |
11 | -class MainWindow; | |
12 | -} | |
13 | - | |
14 | -class MainWindow : public QMainWindow | |
15 | -{ | |
16 | - Q_OBJECT | |
17 | - | |
18 | -public: | |
19 | - explicit MainWindow(QWidget *parent = 0); | |
20 | - ~MainWindow(); | |
21 | - | |
22 | -private slots: | |
23 | - void on_btnStart_clicked(); | |
24 | - | |
25 | - void on_lineEdit_textChanged(const QString &arg1); | |
26 | - | |
27 | - void on_actionExit_triggered(); | |
28 | - | |
29 | - void on_actionSave_triggered(); | |
30 | - | |
31 | - void on_actionToClibboard_triggered(); | |
32 | - | |
33 | - void on_actionAbout_triggered(); | |
34 | - | |
35 | - void on_actionAbout_Qt_triggered(); | |
36 | - | |
37 | - | |
38 | -private: | |
39 | - Ui::MainWindow *ui; | |
40 | - | |
41 | - QImage *image; // 表示画像を保存しておく場所 | |
42 | - QGraphicsScene scene; // QGraphicsView 上に表示させるための準備 | |
43 | - | |
44 | - QRcode *encode(const unsigned char *intext, int length, QRecLevel level); | |
45 | - QPixmap encodeTextToPixmap( QString text, int size, int margin ); | |
46 | - | |
47 | - // int qrdata_expand(unsigned char *qrcode_data, int qrcode_width, int margin, int size, unsigned char* img_data); | |
48 | -}; | |
49 | - | |
50 | -#endif // MAINWINDOW_H | |
1 | +#ifndef MAINWINDOW_H | |
2 | +#define MAINWINDOW_H | |
3 | + | |
4 | +#include <QMainWindow> | |
5 | + | |
6 | +#include <QGraphicsView> | |
7 | + | |
8 | +#include <qrencode.h> | |
9 | + | |
10 | +namespace Ui { | |
11 | +class MainWindow; | |
12 | +} | |
13 | + | |
14 | +class MainWindow : public QMainWindow | |
15 | +{ | |
16 | + Q_OBJECT | |
17 | + | |
18 | +public: | |
19 | + explicit MainWindow(QWidget *parent = 0); | |
20 | + ~MainWindow(); | |
21 | + | |
22 | +private slots: | |
23 | + void on_btnStart_clicked(); | |
24 | + | |
25 | + void on_lineEdit_textChanged(const QString &arg1); | |
26 | + | |
27 | + void on_actionExit_triggered(); | |
28 | + | |
29 | + void on_actionSave_triggered(); | |
30 | + | |
31 | + void on_actionToClibboard_triggered(); | |
32 | + | |
33 | + void on_actionAbout_triggered(); | |
34 | + | |
35 | + void on_actionAbout_Qt_triggered(); | |
36 | + | |
37 | + | |
38 | +private: | |
39 | + Ui::MainWindow *ui; | |
40 | + | |
41 | + QImage *image; // 表示画像を保存しておく場所 | |
42 | + QGraphicsScene scene; // QGraphicsView 上に表示させるための準備 | |
43 | + | |
44 | + QRcode *encode(const unsigned char *intext, int length, QRecLevel level); | |
45 | + QPixmap encodeTextToPixmap( QString text, int size, int margin, int ErrCLevel); | |
46 | +}; | |
47 | + | |
48 | +#endif // MAINWINDOW_H |
@@ -1,275 +1,275 @@ | ||
1 | -<?xml version="1.0" encoding="UTF-8"?> | |
2 | -<ui version="4.0"> | |
3 | - <class>MainWindow</class> | |
4 | - <widget class="QMainWindow" name="MainWindow"> | |
5 | - <property name="geometry"> | |
6 | - <rect> | |
7 | - <x>0</x> | |
8 | - <y>0</y> | |
9 | - <width>410</width> | |
10 | - <height>530</height> | |
11 | - </rect> | |
12 | - </property> | |
13 | - <property name="windowTitle"> | |
14 | - <string>QtQREncode</string> | |
15 | - </property> | |
16 | - <widget class="QWidget" name="centralWidget"> | |
17 | - <widget class="QGraphicsView" name="imgView"> | |
18 | - <property name="geometry"> | |
19 | - <rect> | |
20 | - <x>20</x> | |
21 | - <y>130</y> | |
22 | - <width>371</width> | |
23 | - <height>331</height> | |
24 | - </rect> | |
25 | - </property> | |
26 | - </widget> | |
27 | - <widget class="QLabel" name="label"> | |
28 | - <property name="geometry"> | |
29 | - <rect> | |
30 | - <x>20</x> | |
31 | - <y>60</y> | |
32 | - <width>91</width> | |
33 | - <height>16</height> | |
34 | - </rect> | |
35 | - </property> | |
36 | - <property name="text"> | |
37 | - <string>Input String</string> | |
38 | - </property> | |
39 | - <property name="buddy"> | |
40 | - <cstring>lineEdit</cstring> | |
41 | - </property> | |
42 | - </widget> | |
43 | - <widget class="QLabel" name="label_2"> | |
44 | - <property name="geometry"> | |
45 | - <rect> | |
46 | - <x>20</x> | |
47 | - <y>110</y> | |
48 | - <width>52</width> | |
49 | - <height>14</height> | |
50 | - </rect> | |
51 | - </property> | |
52 | - <property name="text"> | |
53 | - <string>QRcode</string> | |
54 | - </property> | |
55 | - <property name="buddy"> | |
56 | - <cstring>imgView</cstring> | |
57 | - </property> | |
58 | - </widget> | |
59 | - <widget class="QWidget" name="layoutWidget"> | |
60 | - <property name="geometry"> | |
61 | - <rect> | |
62 | - <x>20</x> | |
63 | - <y>80</y> | |
64 | - <width>371</width> | |
65 | - <height>27</height> | |
66 | - </rect> | |
67 | - </property> | |
68 | - <layout class="QHBoxLayout" name="horizontalLayout"> | |
69 | - <item> | |
70 | - <widget class="QLineEdit" name="lineEdit"/> | |
71 | - </item> | |
72 | - <item> | |
73 | - <widget class="QPushButton" name="btnStart"> | |
74 | - <property name="text"> | |
75 | - <string>Encode</string> | |
76 | - </property> | |
77 | - </widget> | |
78 | - </item> | |
79 | - </layout> | |
80 | - </widget> | |
81 | - <widget class="QWidget" name="layoutWidget"> | |
82 | - <property name="geometry"> | |
83 | - <rect> | |
84 | - <x>20</x> | |
85 | - <y>20</y> | |
86 | - <width>83</width> | |
87 | - <height>26</height> | |
88 | - </rect> | |
89 | - </property> | |
90 | - <layout class="QHBoxLayout" name="horizontalLayout_2"> | |
91 | - <item> | |
92 | - <widget class="QLabel" name="label_3"> | |
93 | - <property name="text"> | |
94 | - <string>Size</string> | |
95 | - </property> | |
96 | - </widget> | |
97 | - </item> | |
98 | - <item> | |
99 | - <widget class="QSpinBox" name="spinBox_size"> | |
100 | - <property name="alignment"> | |
101 | - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |
102 | - </property> | |
103 | - <property name="minimum"> | |
104 | - <number>3</number> | |
105 | - </property> | |
106 | - <property name="maximum"> | |
107 | - <number>12</number> | |
108 | - </property> | |
109 | - </widget> | |
110 | - </item> | |
111 | - </layout> | |
112 | - </widget> | |
113 | - <widget class="QWidget" name="layoutWidget"> | |
114 | - <property name="geometry"> | |
115 | - <rect> | |
116 | - <x>110</x> | |
117 | - <y>20</y> | |
118 | - <width>96</width> | |
119 | - <height>26</height> | |
120 | - </rect> | |
121 | - </property> | |
122 | - <layout class="QHBoxLayout" name="horizontalLayout_3"> | |
123 | - <item> | |
124 | - <widget class="QLabel" name="label_4"> | |
125 | - <property name="text"> | |
126 | - <string>Margin</string> | |
127 | - </property> | |
128 | - </widget> | |
129 | - </item> | |
130 | - <item> | |
131 | - <widget class="QSpinBox" name="spinBox_margin"> | |
132 | - <property name="alignment"> | |
133 | - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |
134 | - </property> | |
135 | - <property name="minimum"> | |
136 | - <number>3</number> | |
137 | - </property> | |
138 | - <property name="maximum"> | |
139 | - <number>12</number> | |
140 | - </property> | |
141 | - </widget> | |
142 | - </item> | |
143 | - </layout> | |
144 | - </widget> | |
145 | - <widget class="QWidget" name=""> | |
146 | - <property name="geometry"> | |
147 | - <rect> | |
148 | - <x>220</x> | |
149 | - <y>20</y> | |
150 | - <width>173</width> | |
151 | - <height>26</height> | |
152 | - </rect> | |
153 | - </property> | |
154 | - <layout class="QHBoxLayout" name="horizontalLayout_4"> | |
155 | - <item> | |
156 | - <widget class="QLabel" name="label_5"> | |
157 | - <property name="text"> | |
158 | - <string>ErrorCorrectLevel</string> | |
159 | - </property> | |
160 | - </widget> | |
161 | - </item> | |
162 | - <item> | |
163 | - <widget class="QComboBox" name="comboBox_ErrCrctLevel"> | |
164 | - <item> | |
165 | - <property name="text"> | |
166 | - <string>level L</string> | |
167 | - </property> | |
168 | - </item> | |
169 | - <item> | |
170 | - <property name="text"> | |
171 | - <string>level M</string> | |
172 | - </property> | |
173 | - </item> | |
174 | - <item> | |
175 | - <property name="text"> | |
176 | - <string>level Q</string> | |
177 | - </property> | |
178 | - </item> | |
179 | - <item> | |
180 | - <property name="text"> | |
181 | - <string>level H</string> | |
182 | - </property> | |
183 | - </item> | |
184 | - </widget> | |
185 | - </item> | |
186 | - </layout> | |
187 | - </widget> | |
188 | - <zorder>layoutWidget</zorder> | |
189 | - <zorder>layoutWidget</zorder> | |
190 | - <zorder>imgView</zorder> | |
191 | - <zorder>label</zorder> | |
192 | - <zorder>label_2</zorder> | |
193 | - <zorder>layoutWidget</zorder> | |
194 | - <zorder>comboBox_ErrCrctLevel</zorder> | |
195 | - <zorder>label_5</zorder> | |
196 | - </widget> | |
197 | - <widget class="QMenuBar" name="menuBar"> | |
198 | - <property name="geometry"> | |
199 | - <rect> | |
200 | - <x>0</x> | |
201 | - <y>0</y> | |
202 | - <width>410</width> | |
203 | - <height>22</height> | |
204 | - </rect> | |
205 | - </property> | |
206 | - <widget class="QMenu" name="menuFile"> | |
207 | - <property name="title"> | |
208 | - <string>File</string> | |
209 | - </property> | |
210 | - <addaction name="actionSave"/> | |
211 | - <addaction name="separator"/> | |
212 | - <addaction name="actionExit"/> | |
213 | - </widget> | |
214 | - <widget class="QMenu" name="menuHelp"> | |
215 | - <property name="title"> | |
216 | - <string>Help</string> | |
217 | - </property> | |
218 | - <addaction name="actionAbout"/> | |
219 | - <addaction name="actionAbout_Qt"/> | |
220 | - </widget> | |
221 | - <widget class="QMenu" name="menuEdit"> | |
222 | - <property name="title"> | |
223 | - <string>Edit</string> | |
224 | - </property> | |
225 | - <addaction name="actionToClibboard"/> | |
226 | - </widget> | |
227 | - <addaction name="menuFile"/> | |
228 | - <addaction name="menuEdit"/> | |
229 | - <addaction name="menuHelp"/> | |
230 | - </widget> | |
231 | - <widget class="QToolBar" name="mainToolBar"> | |
232 | - <attribute name="toolBarArea"> | |
233 | - <enum>TopToolBarArea</enum> | |
234 | - </attribute> | |
235 | - <attribute name="toolBarBreak"> | |
236 | - <bool>false</bool> | |
237 | - </attribute> | |
238 | - </widget> | |
239 | - <widget class="QStatusBar" name="statusBar"/> | |
240 | - <action name="actionSave"> | |
241 | - <property name="text"> | |
242 | - <string>Save</string> | |
243 | - </property> | |
244 | - <property name="shortcut"> | |
245 | - <string>Ctrl+S</string> | |
246 | - </property> | |
247 | - </action> | |
248 | - <action name="actionExit"> | |
249 | - <property name="text"> | |
250 | - <string>Exit</string> | |
251 | - </property> | |
252 | - <property name="shortcut"> | |
253 | - <string>Ctrl+Q</string> | |
254 | - </property> | |
255 | - </action> | |
256 | - <action name="actionAbout"> | |
257 | - <property name="text"> | |
258 | - <string>About</string> | |
259 | - </property> | |
260 | - </action> | |
261 | - <action name="actionAbout_Qt"> | |
262 | - <property name="text"> | |
263 | - <string>About Qt</string> | |
264 | - </property> | |
265 | - </action> | |
266 | - <action name="actionToClibboard"> | |
267 | - <property name="text"> | |
268 | - <string>toClibboard</string> | |
269 | - </property> | |
270 | - </action> | |
271 | - </widget> | |
272 | - <layoutdefault spacing="6" margin="11"/> | |
273 | - <resources/> | |
274 | - <connections/> | |
275 | -</ui> | |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<ui version="4.0"> | |
3 | + <class>MainWindow</class> | |
4 | + <widget class="QMainWindow" name="MainWindow"> | |
5 | + <property name="geometry"> | |
6 | + <rect> | |
7 | + <x>0</x> | |
8 | + <y>0</y> | |
9 | + <width>410</width> | |
10 | + <height>530</height> | |
11 | + </rect> | |
12 | + </property> | |
13 | + <property name="windowTitle"> | |
14 | + <string>QtQREncode</string> | |
15 | + </property> | |
16 | + <widget class="QWidget" name="centralWidget"> | |
17 | + <widget class="QGraphicsView" name="imgView"> | |
18 | + <property name="geometry"> | |
19 | + <rect> | |
20 | + <x>20</x> | |
21 | + <y>130</y> | |
22 | + <width>371</width> | |
23 | + <height>331</height> | |
24 | + </rect> | |
25 | + </property> | |
26 | + </widget> | |
27 | + <widget class="QLabel" name="label"> | |
28 | + <property name="geometry"> | |
29 | + <rect> | |
30 | + <x>20</x> | |
31 | + <y>60</y> | |
32 | + <width>91</width> | |
33 | + <height>16</height> | |
34 | + </rect> | |
35 | + </property> | |
36 | + <property name="text"> | |
37 | + <string>Input String</string> | |
38 | + </property> | |
39 | + <property name="buddy"> | |
40 | + <cstring>lineEdit</cstring> | |
41 | + </property> | |
42 | + </widget> | |
43 | + <widget class="QLabel" name="label_2"> | |
44 | + <property name="geometry"> | |
45 | + <rect> | |
46 | + <x>20</x> | |
47 | + <y>110</y> | |
48 | + <width>52</width> | |
49 | + <height>14</height> | |
50 | + </rect> | |
51 | + </property> | |
52 | + <property name="text"> | |
53 | + <string>QRcode</string> | |
54 | + </property> | |
55 | + <property name="buddy"> | |
56 | + <cstring>imgView</cstring> | |
57 | + </property> | |
58 | + </widget> | |
59 | + <widget class="QWidget" name="layoutWidget"> | |
60 | + <property name="geometry"> | |
61 | + <rect> | |
62 | + <x>20</x> | |
63 | + <y>80</y> | |
64 | + <width>371</width> | |
65 | + <height>27</height> | |
66 | + </rect> | |
67 | + </property> | |
68 | + <layout class="QHBoxLayout" name="horizontalLayout"> | |
69 | + <item> | |
70 | + <widget class="QLineEdit" name="lineEdit"/> | |
71 | + </item> | |
72 | + <item> | |
73 | + <widget class="QPushButton" name="btnStart"> | |
74 | + <property name="text"> | |
75 | + <string>Encode</string> | |
76 | + </property> | |
77 | + </widget> | |
78 | + </item> | |
79 | + </layout> | |
80 | + </widget> | |
81 | + <widget class="QWidget" name="layoutWidget"> | |
82 | + <property name="geometry"> | |
83 | + <rect> | |
84 | + <x>20</x> | |
85 | + <y>20</y> | |
86 | + <width>83</width> | |
87 | + <height>26</height> | |
88 | + </rect> | |
89 | + </property> | |
90 | + <layout class="QHBoxLayout" name="horizontalLayout_2"> | |
91 | + <item> | |
92 | + <widget class="QLabel" name="label_3"> | |
93 | + <property name="text"> | |
94 | + <string>Size</string> | |
95 | + </property> | |
96 | + </widget> | |
97 | + </item> | |
98 | + <item> | |
99 | + <widget class="QSpinBox" name="spinBox_size"> | |
100 | + <property name="alignment"> | |
101 | + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |
102 | + </property> | |
103 | + <property name="minimum"> | |
104 | + <number>3</number> | |
105 | + </property> | |
106 | + <property name="maximum"> | |
107 | + <number>12</number> | |
108 | + </property> | |
109 | + </widget> | |
110 | + </item> | |
111 | + </layout> | |
112 | + </widget> | |
113 | + <widget class="QWidget" name="layoutWidget"> | |
114 | + <property name="geometry"> | |
115 | + <rect> | |
116 | + <x>110</x> | |
117 | + <y>20</y> | |
118 | + <width>96</width> | |
119 | + <height>26</height> | |
120 | + </rect> | |
121 | + </property> | |
122 | + <layout class="QHBoxLayout" name="horizontalLayout_3"> | |
123 | + <item> | |
124 | + <widget class="QLabel" name="label_4"> | |
125 | + <property name="text"> | |
126 | + <string>Margin</string> | |
127 | + </property> | |
128 | + </widget> | |
129 | + </item> | |
130 | + <item> | |
131 | + <widget class="QSpinBox" name="spinBox_margin"> | |
132 | + <property name="alignment"> | |
133 | + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> | |
134 | + </property> | |
135 | + <property name="minimum"> | |
136 | + <number>3</number> | |
137 | + </property> | |
138 | + <property name="maximum"> | |
139 | + <number>12</number> | |
140 | + </property> | |
141 | + </widget> | |
142 | + </item> | |
143 | + </layout> | |
144 | + </widget> | |
145 | + <widget class="QWidget" name=""> | |
146 | + <property name="geometry"> | |
147 | + <rect> | |
148 | + <x>220</x> | |
149 | + <y>20</y> | |
150 | + <width>173</width> | |
151 | + <height>26</height> | |
152 | + </rect> | |
153 | + </property> | |
154 | + <layout class="QHBoxLayout" name="horizontalLayout_4"> | |
155 | + <item> | |
156 | + <widget class="QLabel" name="label_5"> | |
157 | + <property name="text"> | |
158 | + <string>ErrorCorrectLevel</string> | |
159 | + </property> | |
160 | + </widget> | |
161 | + </item> | |
162 | + <item> | |
163 | + <widget class="QComboBox" name="comboBox_ErrCrctLevel"> | |
164 | + <item> | |
165 | + <property name="text"> | |
166 | + <string>level L</string> | |
167 | + </property> | |
168 | + </item> | |
169 | + <item> | |
170 | + <property name="text"> | |
171 | + <string>level M</string> | |
172 | + </property> | |
173 | + </item> | |
174 | + <item> | |
175 | + <property name="text"> | |
176 | + <string>level Q</string> | |
177 | + </property> | |
178 | + </item> | |
179 | + <item> | |
180 | + <property name="text"> | |
181 | + <string>level H</string> | |
182 | + </property> | |
183 | + </item> | |
184 | + </widget> | |
185 | + </item> | |
186 | + </layout> | |
187 | + </widget> | |
188 | + <zorder>layoutWidget</zorder> | |
189 | + <zorder>layoutWidget</zorder> | |
190 | + <zorder>imgView</zorder> | |
191 | + <zorder>label</zorder> | |
192 | + <zorder>label_2</zorder> | |
193 | + <zorder>layoutWidget</zorder> | |
194 | + <zorder>comboBox_ErrCrctLevel</zorder> | |
195 | + <zorder>label_5</zorder> | |
196 | + </widget> | |
197 | + <widget class="QMenuBar" name="menuBar"> | |
198 | + <property name="geometry"> | |
199 | + <rect> | |
200 | + <x>0</x> | |
201 | + <y>0</y> | |
202 | + <width>410</width> | |
203 | + <height>22</height> | |
204 | + </rect> | |
205 | + </property> | |
206 | + <widget class="QMenu" name="menuFile"> | |
207 | + <property name="title"> | |
208 | + <string>File</string> | |
209 | + </property> | |
210 | + <addaction name="actionSave"/> | |
211 | + <addaction name="separator"/> | |
212 | + <addaction name="actionExit"/> | |
213 | + </widget> | |
214 | + <widget class="QMenu" name="menuHelp"> | |
215 | + <property name="title"> | |
216 | + <string>Help</string> | |
217 | + </property> | |
218 | + <addaction name="actionAbout"/> | |
219 | + <addaction name="actionAbout_Qt"/> | |
220 | + </widget> | |
221 | + <widget class="QMenu" name="menuEdit"> | |
222 | + <property name="title"> | |
223 | + <string>Edit</string> | |
224 | + </property> | |
225 | + <addaction name="actionToClibboard"/> | |
226 | + </widget> | |
227 | + <addaction name="menuFile"/> | |
228 | + <addaction name="menuEdit"/> | |
229 | + <addaction name="menuHelp"/> | |
230 | + </widget> | |
231 | + <widget class="QToolBar" name="mainToolBar"> | |
232 | + <attribute name="toolBarArea"> | |
233 | + <enum>TopToolBarArea</enum> | |
234 | + </attribute> | |
235 | + <attribute name="toolBarBreak"> | |
236 | + <bool>false</bool> | |
237 | + </attribute> | |
238 | + </widget> | |
239 | + <widget class="QStatusBar" name="statusBar"/> | |
240 | + <action name="actionSave"> | |
241 | + <property name="text"> | |
242 | + <string>Save</string> | |
243 | + </property> | |
244 | + <property name="shortcut"> | |
245 | + <string>Ctrl+S</string> | |
246 | + </property> | |
247 | + </action> | |
248 | + <action name="actionExit"> | |
249 | + <property name="text"> | |
250 | + <string>Exit</string> | |
251 | + </property> | |
252 | + <property name="shortcut"> | |
253 | + <string>Ctrl+Q</string> | |
254 | + </property> | |
255 | + </action> | |
256 | + <action name="actionAbout"> | |
257 | + <property name="text"> | |
258 | + <string>About</string> | |
259 | + </property> | |
260 | + </action> | |
261 | + <action name="actionAbout_Qt"> | |
262 | + <property name="text"> | |
263 | + <string>About Qt</string> | |
264 | + </property> | |
265 | + </action> | |
266 | + <action name="actionToClibboard"> | |
267 | + <property name="text"> | |
268 | + <string>toClibboard</string> | |
269 | + </property> | |
270 | + </action> | |
271 | + </widget> | |
272 | + <layoutdefault spacing="6" margin="11"/> | |
273 | + <resources/> | |
274 | + <connections/> | |
275 | +</ui> |