mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Merge pull request #317 from schdub/issue316
plot: lineType and pointShape options
This commit is contained in:
@@ -163,6 +163,8 @@ void MainWindow::init()
|
||||
restoreState(PreferencesDialog::getSettingsValue("MainWindow", "windowState").toByteArray());
|
||||
ui->comboLogSubmittedBy->setCurrentIndex(ui->comboLogSubmittedBy->findText(PreferencesDialog::getSettingsValue("SQLLogDock", "Log").toString()));
|
||||
ui->splitterForPlot->restoreState(PreferencesDialog::getSettingsValue("PlotDock", "splitterSize").toByteArray());
|
||||
ui->comboLineType->setCurrentIndex(PreferencesDialog::getSettingsValue("PlotDock", "lineType").toInt());
|
||||
ui->comboPointShape->setCurrentIndex(PreferencesDialog::getSettingsValue("PlotDock", "pointShape").toInt());
|
||||
|
||||
// plot widgets
|
||||
ui->treePlotColumns->setSelectionMode(QAbstractItemView::NoSelection);
|
||||
@@ -432,6 +434,8 @@ void MainWindow::closeEvent( QCloseEvent* event )
|
||||
PreferencesDialog::setSettingsValue("MainWindow", "windowState", saveState());
|
||||
PreferencesDialog::setSettingsValue("SQLLogDock", "Log", ui->comboLogSubmittedBy->currentText());
|
||||
PreferencesDialog::setSettingsValue("PlotDock", "splitterSize", ui->splitterForPlot->saveState());
|
||||
PreferencesDialog::setSettingsValue("PlotDock", "lineType", ui->comboLineType->currentIndex());
|
||||
PreferencesDialog::setSettingsValue("PlotDock", "pointShape", ui->comboPointShape->currentIndex());
|
||||
QMainWindow::closeEvent(event);
|
||||
} else {
|
||||
event->ignore();
|
||||
@@ -1624,8 +1628,8 @@ void MainWindow::updatePlot(SqliteTableModel *model, bool update)
|
||||
// set some graph styles, this could also be improved to let the user choose
|
||||
// some styling
|
||||
graph->setData(xdata, ydata);
|
||||
graph->setLineStyle(QCPGraph::lsLine);
|
||||
graph->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssDisc, 5));
|
||||
graph->setLineStyle((QCPGraph::LineStyle) ui->comboLineType->currentIndex());
|
||||
graph->setScatterStyle(QCPScatterStyle((QCPScatterStyle::ScatterShape)ui->comboPointShape->currentIndex(), 5));
|
||||
|
||||
// gather Y label column names
|
||||
yAxisLabels << model->headerData(y, Qt::Horizontal).toString();
|
||||
@@ -2110,3 +2114,31 @@ void MainWindow::copyCurrentCreateStatement()
|
||||
// Copy the statement to the global application clipboard
|
||||
QApplication::clipboard()->setText(stmt);
|
||||
}
|
||||
|
||||
void MainWindow::on_comboLineType_currentIndexChanged(int index)
|
||||
{
|
||||
Q_ASSERT(index >= QCPGraph::lsNone &&
|
||||
index <= QCPGraph::lsImpulse);
|
||||
QCPGraph::LineStyle lineStyle = (QCPGraph::LineStyle) index;
|
||||
for (int i = 0, ie = ui->plotWidget->graphCount(); i < ie; ++i)
|
||||
{
|
||||
QCPGraph * graph = ui->plotWidget->graph(i);
|
||||
if (graph)
|
||||
graph->setLineStyle(lineStyle);
|
||||
}
|
||||
ui->plotWidget->replot();
|
||||
}
|
||||
|
||||
void MainWindow::on_comboPointShape_currentIndexChanged(int index)
|
||||
{
|
||||
Q_ASSERT(index >= QCPScatterStyle::ssNone &&
|
||||
index < QCPScatterStyle::ssPixmap);
|
||||
QCPScatterStyle::ScatterShape shape = (QCPScatterStyle::ScatterShape) index;
|
||||
for (int i = 0, ie = ui->plotWidget->graphCount(); i < ie; ++i)
|
||||
{
|
||||
QCPGraph * graph = ui->plotWidget->graph(i);
|
||||
if (graph)
|
||||
graph->setScatterStyle(QCPScatterStyle(shape, 5));
|
||||
}
|
||||
ui->plotWidget->replot();
|
||||
}
|
||||
|
||||
@@ -177,6 +177,8 @@ private slots:
|
||||
void switchToBrowseDataTab();
|
||||
void on_buttonClearFilters_clicked();
|
||||
void copyCurrentCreateStatement();
|
||||
void on_comboLineType_currentIndexChanged(int index);
|
||||
void on_comboPointShape_currentIndexChanged(int index);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1000</width>
|
||||
<width>1037</width>
|
||||
<height>630</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -22,7 +22,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="mainTab">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="structure">
|
||||
<attribute name="title">
|
||||
@@ -324,8 +324,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>294</width>
|
||||
<height>444</height>
|
||||
<width>472</width>
|
||||
<height>531</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
@@ -809,8 +809,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1000</width>
|
||||
<height>19</height>
|
||||
<width>1037</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="fileMenu">
|
||||
@@ -1074,6 +1074,144 @@
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Line type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboLineType">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Line</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>StepLeft</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>StepRight</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>StepCenter</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Impulse</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Point shape:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboPointShape">
|
||||
<property name="currentIndex">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Dot</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Cross</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Plus</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Circle</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Disc</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Square</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Diamond</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Star</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Triangle</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>TriangleInverted</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>CrossSquare</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>PlusSquare</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>CrossCircle</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>PlusCircle</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Peace</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
@@ -1656,6 +1794,7 @@
|
||||
<tabstop>dbTreeWidget</tabstop>
|
||||
<tabstop>comboBrowseTable</tabstop>
|
||||
<tabstop>buttonRefresh</tabstop>
|
||||
<tabstop>buttonClearFilters</tabstop>
|
||||
<tabstop>buttonNewRecord</tabstop>
|
||||
<tabstop>buttonDeleteRecord</tabstop>
|
||||
<tabstop>dataTable</tabstop>
|
||||
|
||||
@@ -300,6 +300,18 @@ QVariant PreferencesDialog::getSettingsDefaultValue(const QString& group, const
|
||||
if(group == "extension" && name == "disableregex")
|
||||
return false;
|
||||
|
||||
// PlotDock/lineType or pointShape?
|
||||
if(group == "PlotDock")
|
||||
{
|
||||
// QCPGraph::lsLine
|
||||
if(name == "lineType")
|
||||
return 1;
|
||||
|
||||
// QCPScatterStyle::ssDisk
|
||||
if(name == "pointShape")
|
||||
return 5;
|
||||
}
|
||||
|
||||
// Unknown combination of group and name? Return an invalid QVariant!
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user