diff options
author | Tim E. Real <termtech@rogers.com> | 2010-11-27 00:49:10 +0000 |
---|---|---|
committer | Tim E. Real <termtech@rogers.com> | 2010-11-27 00:49:10 +0000 |
commit | 16dbc206d810e3c753800b9503e38f129847592f (patch) | |
tree | 64c0f102a78962ef679948a537a7183e9cf549f1 /muse2/muse | |
parent | d0072018d13594b5aa1ad0a04dd036676dae8b5a (diff) |
Converted comboQuant widget to Qt4 (in miditransform dialog).
Diffstat (limited to 'muse2/muse')
-rw-r--r-- | muse2/muse/miditransform.cpp | 2 | ||||
-rw-r--r-- | muse2/muse/mplugins/midiitransform.cpp | 5 | ||||
-rw-r--r-- | muse2/muse/widgets/comboQuant.cpp | 49 | ||||
-rw-r--r-- | muse2/muse/widgets/comboQuant.h | 12 | ||||
-rw-r--r-- | muse2/muse/widgets/tb1.cpp | 10 | ||||
-rw-r--r-- | muse2/muse/widgets/tb1.h | 6 | ||||
-rw-r--r-- | muse2/muse/widgets/transformbase.ui | 2 |
7 files changed, 58 insertions, 28 deletions
diff --git a/muse2/muse/miditransform.cpp b/muse2/muse/miditransform.cpp index 60ab7517..6593e826 100644 --- a/muse2/muse/miditransform.cpp +++ b/muse2/muse/miditransform.cpp @@ -22,7 +22,7 @@ #include "xml.h" #include "globals.h" #include "comboQuant.h" -#include "pitchedit.h" +//#include "pitchedit.h" #include "audio.h" #include "gconfig.h" #include "midictrl.h" diff --git a/muse2/muse/mplugins/midiitransform.cpp b/muse2/muse/mplugins/midiitransform.cpp index c31ac7ec..22f3630f 100644 --- a/muse2/muse/mplugins/midiitransform.cpp +++ b/muse2/muse/mplugins/midiitransform.cpp @@ -25,8 +25,9 @@ #include "xml.h" #include "globals.h" #include "gconfig.h" -#include "comboQuant.h" -#include "pitchedit.h" +//#include "comboQuant.h" +//#include "pitchedit.h" +#include "helper.h" #define MIDITRANSFORM_NOTE 0 #define MIDITRANSFORM_POLY 1 diff --git a/muse2/muse/widgets/comboQuant.cpp b/muse2/muse/widgets/comboQuant.cpp index 4a81bc8e..ec3a4f4a 100644 --- a/muse2/muse/widgets/comboQuant.cpp +++ b/muse2/muse/widgets/comboQuant.cpp @@ -5,7 +5,10 @@ // (C) Copyright 2001 Werner Schweer (ws@seh.de) //========================================================= -#include <q3listbox.h> +#include <QTableWidget> +#include <QTableWidgetItem> +#include <QHeaderView> + #include "comboQuant.h" static int quantTable[] = { @@ -24,15 +27,33 @@ static const char* quantStrings[] = { // ComboQuant //--------------------------------------------------------- -ComboQuant::ComboQuant(QWidget* parent, const char* name) - : QComboBox(parent, name) +ComboQuant::ComboQuant(QWidget* parent) + : QComboBox(parent) { - Q3ListBox* qlist = new Q3ListBox(this); - qlist->setMinimumWidth(95); + ///Q3ListBox* qlist = new Q3ListBox(this); + ///qlist->setMinimumWidth(95); //setListBox(qlist); ddskrjo - qlist->setColumnMode(3); - for (int i = 0; i < 24; i++) - qlist->insertItem(tr(quantStrings[i]), i); + ///qlist->setColumnMode(3); + + + qlist = new QTableWidget(8, 3); + qlist->verticalHeader()->setDefaultSectionSize(22); + qlist->horizontalHeader()->setDefaultSectionSize(32); + qlist->setSelectionMode(QAbstractItemView::SingleSelection); + qlist->verticalHeader()->hide(); + qlist->horizontalHeader()->hide(); + + qlist->setMinimumWidth(96); + + setView(qlist); + + ///for (int i = 0; i < 24; i++) + /// qlist->insertItem(tr(quantStrings[i]), i); + for (int j = 0; j < 3; j++) + for (int i = 0; i < 8; i++) + qlist->setItem(i, j, new QTableWidgetItem(tr(quantStrings[i + j * 8]))); + + connect(this, SIGNAL(activated(int)), SLOT(activated(int))); } @@ -42,7 +63,8 @@ ComboQuant::ComboQuant(QWidget* parent, const char* name) void ComboQuant::activated(int index) { - emit valueChanged(quantTable[index]); + ///emit valueChanged(quantTable[index]); + emit valueChanged(quantTable[qlist->currentRow() + qlist->currentColumn() * 8]); } //--------------------------------------------------------- @@ -57,5 +79,14 @@ void ComboQuant::setValue(int val) return; } } + + for (unsigned i = 0; i < sizeof(quantTable)/sizeof(*quantTable); i++) { + if (val == quantTable[i]) { + setCurrentIndex(i); + return; + } + } + printf("ComboQuant::setValue(%d) not defined\n", val); + setCurrentIndex(0); } diff --git a/muse2/muse/widgets/comboQuant.h b/muse2/muse/widgets/comboQuant.h index 0031fa33..501f0a14 100644 --- a/muse2/muse/widgets/comboQuant.h +++ b/muse2/muse/widgets/comboQuant.h @@ -8,8 +8,12 @@ #ifndef __COMBOQUANT_H__ #define __COMBOQUANT_H__ -#include <qwidget.h> -#include <qcombobox.h> +#include <QComboBox> +//#include <QWidget> +//#include <QTableWidget> + +class QWidget; +class QTableWidget; //--------------------------------------------------------- // ComboQuant @@ -18,6 +22,8 @@ class ComboQuant : public QComboBox { Q_OBJECT + QTableWidget* qlist; + private slots: void activated(int); @@ -25,7 +31,7 @@ class ComboQuant : public QComboBox { void valueChanged(int); public: - ComboQuant(QWidget* parent = 0, const char* name = 0); + ComboQuant(QWidget* parent = 0); void setValue(int val); }; diff --git a/muse2/muse/widgets/tb1.cpp b/muse2/muse/widgets/tb1.cpp index 180632eb..ab4961cc 100644 --- a/muse2/muse/widgets/tb1.cpp +++ b/muse2/muse/widgets/tb1.cpp @@ -5,20 +5,16 @@ // (C) Copyright 1999 Werner Schweer (ws@seh.de) //========================================================= -#include <assert.h> +//#include <assert.h> #include <stdio.h> #include <values.h> -//#include <qlabel.h> -//#include <qlayout.h> -//#include <q3listbox.h> -//#include <qtoolbutton.h> -// p4.0.3 #include <QLabel> #include <QLayout> #include <QToolButton> #include <QTableWidget> -#include <QListWidget> +#include <QTableWidgetItem> +#include <QComboBox> #include "config.h" #include "lcombo.h" diff --git a/muse2/muse/widgets/tb1.h b/muse2/muse/widgets/tb1.h index 803f55fd..bbd52469 100644 --- a/muse2/muse/widgets/tb1.h +++ b/muse2/muse/widgets/tb1.h @@ -8,9 +8,6 @@ #ifndef __TB1_H__ #define __TB1_H__ -//#include <qwidget.h> -//#include <q3toolbar.h> - #include <QWidget> #include <QToolBar> @@ -25,8 +22,7 @@ class QTableWidget; // Toolbar1 //--------------------------------------------------------- -//class Toolbar1 : public Q3ToolBar { -class Toolbar1 : public QToolBar { // p4.0.4 +class Toolbar1 : public QToolBar { QToolButton* solo; PosLabel* pos; PitchLabel* pitch; diff --git a/muse2/muse/widgets/transformbase.ui b/muse2/muse/widgets/transformbase.ui index 1b8ca5f2..578b4a97 100644 --- a/muse2/muse/widgets/transformbase.ui +++ b/muse2/muse/widgets/transformbase.ui @@ -992,7 +992,7 @@ </customwidget> <customwidget> <class>ComboQuant</class> - <extends>QWidget</extends> + <extends>QComboBox</extends> <header>comboQuant.h</header> </customwidget> </customwidgets> |