[Kst] branches/work/kst/portto4/kst/src
Adam Treat
treat at kde.org
Tue Sep 25 18:53:54 CEST 2007
SVN commit 716935 by treat:
* Bugfix for Kst::fileRequester. This hacks
around a bug in Qt. Grrr...
M +18 -5 libkstapp/vectordialog.cpp
M +2 -1 libkstapp/vectordialog.h
M +11 -1 libkstapp/vectortab.ui
M +9 -4 widgets/filerequester.cpp
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.cpp #716934:716935
@@ -15,7 +15,7 @@
#include "kstsvector.h"
-#include <limits.h>
+#include <QDir>
namespace Kst {
@@ -25,7 +25,12 @@
setupUi(this);
setTabTitle(tr("Vector"));
- connect(_readFromSource, SIGNAL(toggled(bool)), this, SLOT(sourceChanged()));
+ connect(_readFromSource, SIGNAL(toggled(bool)),
+ this, SLOT(readFromSourceChanged()));
+ connect(_fileName, SIGNAL(changed(const QString &)),
+ this, SLOT(fileNameChanged(const QString &)));
+
+ _fileName->setFile(QDir::currentPath());
}
@@ -58,7 +63,7 @@
}
-void VectorTab::sourceChanged() {
+void VectorTab::readFromSourceChanged() {
if (_readFromSource->isChecked())
setMode(ReadOnlyVector);
@@ -71,6 +76,14 @@
}
+void VectorTab::fileNameChanged(const QString &file) {
+ //FIXME deep magic...
+ QFileInfo info(file);
+ if (info.exists() && info.isFile())
+ qDebug() << "fileNameChanged" << endl;
+}
+
+
VectorDialog::VectorDialog(QWidget *parent)
: DataDialog(parent) {
@@ -109,8 +122,8 @@
} else if (_vectorTab->mode() == VectorTab::SlaveVector) {
- const int from = _vectorTab->from();
- const int to = _vectorTab->to();
+ const qreal from = _vectorTab->from();
+ const qreal to = _vectorTab->to();
const int numberOfSamples = _vectorTab->numberOfSamples();
const KstObjectTag tag = KstObjectTag(tagName(), KstObjectTag::globalTagContext);
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.h #716934:716935
@@ -43,7 +43,8 @@
void setNumberOfSamples(int numberOfSamples);
private Q_SLOTS:
- void sourceChanged();
+ void readFromSourceChanged();
+ void fileNameChanged(const QString &file);
private:
Mode _mode;
--- branches/work/kst/portto4/kst/src/libkstapp/vectortab.ui #716934:716935
@@ -137,7 +137,11 @@
</widget>
</item>
<item row="1" column="1" >
- <widget class="Kst::ComboBox" name="_field" />
+ <widget class="Kst::ComboBox" name="_field" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ </widget>
</item>
<item row="2" column="0" colspan="2" >
<layout class="QHBoxLayout" >
@@ -171,6 +175,9 @@
</item>
<item>
<widget class="QPushButton" name="_connect" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
<property name="text" >
<string>Conn&ect</string>
</property>
@@ -178,6 +185,9 @@
</item>
<item>
<widget class="QPushButton" name="_configure" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
<property name="text" >
<string>Con&figure...</string>
</property>
--- branches/work/kst/portto4/kst/src/widgets/filerequester.cpp #716934:716935
@@ -16,6 +16,8 @@
#include <QHBoxLayout>
#include <QFileDialog>
+#include <QDebug>
+
namespace Kst {
FileRequester::FileRequester(QWidget *parent)
@@ -52,7 +54,7 @@
_fileButton->setIcon(QPixmap(":kst_changefile.png"));
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
- connect (_fileEdit, SIGNAL(textChanged(const QString &)), this, SLOT(setFile(const QString &)));
+ connect (_fileEdit, SIGNAL(textEdited(const QString &)), this, SLOT(setFile(const QString &)));
connect (_fileButton, SIGNAL(clicked()), this, SLOT(chooseFile()));
}
@@ -68,16 +70,19 @@
void FileRequester::setFile(const QString &file) {
_file = file;
+ //FIXME grrr QLineEdit doc *lies* to me... the textEdited signal is being triggered!!
+ _fileEdit->blockSignals(true);
+ _fileEdit->setText(_file);
+ _fileEdit->blockSignals(false);
emit changed(file);
}
void FileRequester::chooseFile() {
- bool ok;
QString file = QFileDialog::getOpenFileName(this);
- if (ok && !file.isEmpty()) {
- _fileEdit->setText(file); //will call setFile...
+ if (!file.isEmpty()) {
+ setFile(file);
}
}
More information about the Kst
mailing list