[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Eliot-dev] eliot/qt Makefile.am bag_widget.cpp bag_widget....
From: |
Olivier Teulière |
Subject: |
[Eliot-dev] eliot/qt Makefile.am bag_widget.cpp bag_widget.... |
Date: |
Sun, 12 Sep 2010 15:27:40 +0000 |
CVSROOT: /cvsroot/eliot
Module name: eliot
Changes by: Olivier Teulière <ipkiss> 10/09/12 15:27:40
Modified files:
qt : Makefile.am bag_widget.cpp bag_widget.h
Added files:
qt/ui : bag_widget.ui
Log message:
Display the number of remaining vowels, consonants and jokers in the
bag window
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/Makefile.am?cvsroot=eliot&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/bag_widget.cpp?cvsroot=eliot&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/bag_widget.h?cvsroot=eliot&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/ui/bag_widget.ui?cvsroot=eliot&rev=1.1
Patches:
Index: Makefile.am
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/Makefile.am,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- Makefile.am 15 May 2010 12:20:19 -0000 1.18
+++ Makefile.am 12 Sep 2010 15:27:38 -0000 1.19
@@ -44,6 +44,7 @@
ui/dic_wizard_info_page.ui \
ui/dic_wizard_letters_def_page.ui \
ui/dic_wizard_conclusion_page.ui \
+ ui/bag_widget.ui \
ui/main_window.ui \
ui/new_game.ui \
ui/player_widget.ui \
@@ -73,6 +74,7 @@
nodist_eliot_SOURCES = \
ui/main_window.ui.h \
+ ui/bag_widget.ui.h \
ui/new_game.ui.h \
ui/player_widget.ui.h \
ui/training_widget.ui.h \
Index: bag_widget.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/bag_widget.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- bag_widget.cpp 23 Jun 2009 12:41:54 -0000 1.6
+++ bag_widget.cpp 12 Sep 2010 15:27:40 -0000 1.7
@@ -21,6 +21,7 @@
#include <boost/foreach.hpp>
#include <vector>
#include <QtGui/QTreeView>
+#include <QtGui/QVBoxLayout>
#include <QtGui/QStandardItemModel>
#include "bag_widget.h"
@@ -34,22 +35,20 @@
BagWidget::BagWidget(QWidget *parent)
- : QTreeView(parent), m_game(NULL)
+ : QWidget(parent), m_game(NULL)
{
- // Create the tree view
- setEditTriggers(QAbstractItemView::NoEditTriggers);
- setRootIsDecorated(false);
- setSortingEnabled(true);
- QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Expanding);
- setSizePolicy(policy);
+ setupUi(this);
// Associate the model to the view
m_model = new QStandardItemModel(this);
- setModel(m_model);
+ treeView->setModel(m_model);
m_model->setColumnCount(2);
m_model->setHeaderData(0, Qt::Horizontal, _q("Letter"), Qt::DisplayRole);
m_model->setHeaderData(1, Qt::Horizontal, _q("Points"), Qt::DisplayRole);
updateModel();
+
+ treeView->setColumnWidth(0, 90);
+ treeView->setColumnWidth(1, 10);
}
@@ -57,6 +56,9 @@
{
m_game = iGame;
updateModel();
+
+ treeView->resizeColumnToContents(0);
+ treeView->resizeColumnToContents(1);
}
@@ -90,8 +92,10 @@
m_model->setData(m_model->index(rowNum, 1), tile.getPoints());
}
}
- //resizeColumnToContents(0);
- resizeColumnToContents(1);
+
+ labelVowels->setText(QString("%1").arg(bag.getNbVowels()));
+ labelConsonants->setText(QString("%1").arg(bag.getNbConsonants()));
+ labelJokers->setText(QString("%1").arg(bag.in(Tile::Joker())));
}
Index: bag_widget.h
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/bag_widget.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- bag_widget.h 30 Nov 2008 20:53:45 -0000 1.3
+++ bag_widget.h 12 Sep 2010 15:27:40 -0000 1.4
@@ -21,13 +21,15 @@
#ifndef BAG_WIDGET_H_
#define BAG_WIDGET_H_
-#include <QtGui/QTreeView>
+#include <QtGui/QWidget>
+#include <ui/bag_widget.ui.h>
class PublicGame;
+//class QTreeView;
class QStandardItemModel;
-class BagWidget: public QTreeView
+class BagWidget: public QWidget, private Ui::BagWidget
{
Q_OBJECT;
@@ -46,6 +48,8 @@
/// Encapsulated game, can be NULL
const PublicGame *m_game;
+//QTreeView *m_treeView;
+
/// Model of the bag
QStandardItemModel *m_model;
Index: ui/bag_widget.ui
===================================================================
RCS file: ui/bag_widget.ui
diff -N ui/bag_widget.ui
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ui/bag_widget.ui 12 Sep 2010 15:27:40 -0000 1.1
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>BagWidget</class>
+ <widget class="QWidget" name="BagWidget">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>263</width>
+ <height>558</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QTreeView" name="treeView">
+ <property name="rootIsDecorated">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>_("Remaining vowels:")</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="labelVowels">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>_("Remaining consonants:")</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="labelConsonants">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>_("Remaining jokers:")</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="labelJokers">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Eliot-dev] eliot/qt Makefile.am bag_widget.cpp bag_widget....,
Olivier Teulière <=