• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

百人一首かるた 流しの練習用


Commit MetaInfo

Revisionae0ab68818cadeb3bd2a07be98bc210e4ecf98cc (tree)
Time2012-10-15 22:58:45
Authorarakaki <alucky4416@user...>
Commiterarakaki

Log Message

CHG: Add FudaImgView Class (QGraphicsView SubClass, MousePressEvent Override) for FudaImage Change. and Delete FudaClick Bottun.

Change Summary

Incremental Difference

--- a/QtKarutaNagashi.pro
+++ b/QtKarutaNagashi.pro
@@ -10,10 +10,12 @@ TARGET = QtKarutaNagashi
1010 TEMPLATE = app
1111
1212
13-SOURCES += main.cpp\
14- mainwindow.cpp
13+SOURCES += main.cpp \
14+ mainwindow.cpp \
15+ fudaimgview.cpp
1516
1617 HEADERS += mainwindow.h \
18+ fudaimgview.h \
1719 textrsc.h
1820
1921 FORMS += mainwindow.ui
@@ -22,4 +24,3 @@ RESOURCES += \
2224 QtKarutaNagashi.qrc
2325
2426 RC_FILE = Icon.rc
25-
--- /dev/null
+++ b/fudaimgview.cpp
@@ -0,0 +1,15 @@
1+#include "fudaimgview.h"
2+
3+#include <QDebug>
4+
5+FudaImgView::FudaImgView(QWidget *parent) :
6+ QGraphicsView(parent)
7+{
8+ ;
9+}
10+
11+void FudaImgView::mousePressEvent(QMouseEvent * event)
12+{
13+// qDebug() << __FUNCTION__;
14+ emit mousePress();
15+}
--- /dev/null
+++ b/fudaimgview.h
@@ -0,0 +1,23 @@
1+#ifndef FUDAIMGVIEW_H
2+#define FUDAIMGVIEW_H
3+
4+#include <QtGui>
5+
6+class FudaImgView : public QGraphicsView
7+{
8+ Q_OBJECT
9+
10+public:
11+ explicit FudaImgView(QWidget *parent = 0);
12+
13+protected:
14+ void mousePressEvent(QMouseEvent * event);
15+
16+signals:
17+ void mousePress();
18+
19+public slots:
20+
21+};
22+
23+#endif // FUDAIMGVIEW_H
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -46,6 +46,7 @@ MainWindow::MainWindow(QWidget *parent) :
4646 ui->Slct_FudaMuki->addItem(tr("ランダム"));
4747 ui->label_5->setEnabled(false);
4848
49+ connect(ui->gView_Fuda, SIGNAL(mousePress()), this, SLOT(Fuda_clicked()));
4950 // qDebug() << QCoreApplication::applicationDirPath();
5051 // qDebug() << QCoreApplication::applicationFilePath();
5152 AppPath = QCoreApplication::applicationDirPath();
@@ -126,6 +127,21 @@ void MainWindow::TimeoutDone()
126127 }
127128 }
128129
130+void MainWindow::Fuda_clicked()
131+{
132+ // Update FudaImage
133+ if (execflag && mode == 1) {
134+ fudaindex++;
135+ if (fudaindex >= maisu) {
136+// if (mode == 0) timer->stop();
137+ execflag = false;
138+ EndingFuda();
139+ } else {
140+ UpdateFuda();
141+ }
142+ }
143+}
144+
129145 void MainWindow::on_Btn_Start_clicked()
130146 {
131147 // int mode; // モード自動(0)/手動(1)
@@ -149,8 +165,9 @@ void MainWindow::on_Btn_Start_clicked()
149165 maisu = ui->Num_Count->value();
150166 waittime = (int)(ui->Num_WaitTime->value() * 1000);
151167 muki = ui->Slct_FudaMuki->currentIndex();
152- QString msg = QString("mode is %1, maisu is %2, waittime is %3, muki is %4").arg(mode).arg(maisu).arg(waittime).arg(muki);
153- qDebug() << msg;
168+
169+// QString msg = QString("mode is %1, maisu is %2, waittime is %3, muki is %4").arg(mode).arg(maisu).arg(waittime).arg(muki);
170+// qDebug() << msg;
154171
155172 // Generate Random Datas
156173 for (int i = 0; i < 100; i++) {
@@ -193,8 +210,8 @@ void MainWindow::on_Btn_Restart_clicked()
193210 maisu = ui->Num_Count->value();
194211 waittime = (int)(ui->Num_WaitTime->value() * 1000 + 1);
195212 muki = ui->Slct_FudaMuki->currentIndex();
196- QString msg = QString("mode is %1, maisu is %2, waittime is %3, muki is %4").arg(mode).arg(maisu).arg(waittime).arg(muki);
197- qDebug() << msg;
213+// QString msg = QString("mode is %1, maisu is %2, waittime is %3, muki is %4").arg(mode).arg(maisu).arg(waittime).arg(muki);
214+// qDebug() << msg;
198215
199216 execflag = true;
200217 fudaindex = 0;
@@ -225,10 +242,8 @@ void MainWindow::on_Slct_Mode_currentIndexChanged(int index)
225242 // qDebug() << msg;
226243
227244 if (index) {
228- ui->Btn_Fuda->setEnabled(true);
229245 ui->label_5->setEnabled(true);
230246 } else {
231- ui->Btn_Fuda->setEnabled(false);
232247 ui->label_5->setEnabled(false);
233248 }
234249 }
@@ -247,7 +262,7 @@ void MainWindow::on_actionExit_triggered()
247262
248263 void MainWindow::on_actionAbout_triggered()
249264 {
250- QMessageBox::about(this, "About", tr("流しの練習 v0.2"));
265+ QMessageBox::about(this, "About", tr("流しの練習 v0.3"));
251266 }
252267
253268 void MainWindow::on_actionAbout_Qt_triggered()
@@ -255,21 +270,6 @@ void MainWindow::on_actionAbout_Qt_triggered()
255270 QApplication::aboutQt();
256271 }
257272
258-void MainWindow::on_Btn_Fuda_clicked()
259-{
260- // Update FudaImage
261- if (execflag && mode == 1) {
262- fudaindex++;
263- if (fudaindex >= maisu) {
264-// if (mode == 0) timer->stop();
265- execflag = false;
266- EndingFuda();
267- } else {
268- UpdateFuda();
269- }
270- }
271-}
272-
273273 void MainWindow::on_checkBox_DispKaminoku_stateChanged(int chk)
274274 {
275275 if (chk) {
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -35,14 +35,14 @@ private slots:
3535
3636 void TimeoutDone();
3737
38+ void Fuda_clicked();
39+
3840 void on_actionExit_triggered();
3941
4042 void on_actionAbout_triggered();
4143
4244 void on_actionAbout_Qt_triggered();
4345
44- void on_Btn_Fuda_clicked();
45-
4646 void on_checkBox_DispKaminoku_stateChanged(int );
4747
4848 private:
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -32,7 +32,7 @@
3232 <string>競技かるた - 流しの練習</string>
3333 </property>
3434 <property name="windowIcon">
35- <iconset resource="KarutaNagashi.qrc">
35+ <iconset resource="QtKarutaNagashi.qrc">
3636 <normaloff>:/images/KarutaNagashiIcon.png</normaloff>:/images/KarutaNagashiIcon.png</iconset>
3737 </property>
3838 <widget class="QWidget" name="centralWidget">
@@ -157,7 +157,7 @@ p, li { white-space: pre-wrap; }
157157 <number>-1</number>
158158 </property>
159159 </widget>
160- <widget class="QGraphicsView" name="gView_Fuda">
160+ <widget class="FudaImgView" name="gView_Fuda">
161161 <property name="enabled">
162162 <bool>true</bool>
163163 </property>
@@ -270,15 +270,18 @@ p, li { white-space: pre-wrap; }
270270 <widget class="QLabel" name="label_5">
271271 <property name="geometry">
272272 <rect>
273- <x>390</x>
273+ <x>360</x>
274274 <y>330</y>
275- <width>161</width>
275+ <width>221</width>
276276 <height>16</height>
277277 </rect>
278278 </property>
279279 <property name="text">
280280 <string>手動の時は札をクリックしてください。</string>
281281 </property>
282+ <property name="alignment">
283+ <set>Qt::AlignCenter</set>
284+ </property>
282285 </widget>
283286 <widget class="QLabel" name="label_6">
284287 <property name="geometry">
@@ -304,37 +307,12 @@ p, li { white-space: pre-wrap; }
304307 <string/>
305308 </property>
306309 <property name="pixmap">
307- <pixmap resource="KarutaNagashi.qrc">:/images/NagashiTitle.png</pixmap>
310+ <pixmap resource="QtKarutaNagashi.qrc">:/images/NagashiTitle.png</pixmap>
308311 </property>
309312 <property name="alignment">
310313 <set>Qt::AlignCenter</set>
311314 </property>
312315 </widget>
313- <widget class="QPushButton" name="Btn_Fuda">
314- <property name="enabled">
315- <bool>false</bool>
316- </property>
317- <property name="geometry">
318- <rect>
319- <x>360</x>
320- <y>40</y>
321- <width>221</width>
322- <height>291</height>
323- </rect>
324- </property>
325- <property name="focusPolicy">
326- <enum>Qt::NoFocus</enum>
327- </property>
328- <property name="autoFillBackground">
329- <bool>false</bool>
330- </property>
331- <property name="text">
332- <string/>
333- </property>
334- <property name="flat">
335- <bool>true</bool>
336- </property>
337- </widget>
338316 <widget class="QPlainTextEdit" name="TextEdit_Kaminoku">
339317 <property name="enabled">
340318 <bool>true</bool>
@@ -399,7 +377,7 @@ p, li { white-space: pre-wrap; }
399377 <string>開始</string>
400378 </property>
401379 <property name="icon">
402- <iconset resource="KarutaNagashi.qrc">
380+ <iconset resource="QtKarutaNagashi.qrc">
403381 <normaloff>:/images/Play.png</normaloff>:/images/Play.png</iconset>
404382 </property>
405383 </widget>
@@ -424,7 +402,7 @@ p, li { white-space: pre-wrap; }
424402 <string>もう一度</string>
425403 </property>
426404 <property name="icon">
427- <iconset resource="KarutaNagashi.qrc">
405+ <iconset resource="QtKarutaNagashi.qrc">
428406 <normaloff>:/images/RePlay.png</normaloff>:/images/RePlay.png</iconset>
429407 </property>
430408 </widget>
@@ -449,7 +427,7 @@ p, li { white-space: pre-wrap; }
449427 <string>中止</string>
450428 </property>
451429 <property name="icon">
452- <iconset resource="KarutaNagashi.qrc">
430+ <iconset resource="QtKarutaNagashi.qrc">
453431 <normaloff>:/images/Stop.png</normaloff>:/images/Stop.png</iconset>
454432 </property>
455433 </widget>
@@ -460,7 +438,7 @@ p, li { white-space: pre-wrap; }
460438 <x>0</x>
461439 <y>0</y>
462440 <width>600</width>
463- <height>19</height>
441+ <height>22</height>
464442 </rect>
465443 </property>
466444 <widget class="QMenu" name="menuFile">
@@ -508,8 +486,15 @@ p, li { white-space: pre-wrap; }
508486 </action>
509487 </widget>
510488 <layoutdefault spacing="6" margin="11"/>
489+ <customwidgets>
490+ <customwidget>
491+ <class>FudaImgView</class>
492+ <extends>QGraphicsView</extends>
493+ <header>fudaimgview.h</header>
494+ </customwidget>
495+ </customwidgets>
511496 <resources>
512- <include location="KarutaNagashi.qrc"/>
497+ <include location="QtKarutaNagashi.qrc"/>
513498 </resources>
514499 <connections/>
515500 </ui>