FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

plot: lineType and pointShape options by schdub · Pull Request #317 · sqlitebrowser/sqlitebrowser · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .cpp  (2) .h  (1) .ui  (1) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
36 changes: 34 additions & 2 deletions src/MainWindow.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
}
2 changes: 2 additions & 0 deletions src/MainWindow.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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
151 changes: 145 additions & 6 deletions src/MainWindow.ui
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1000</width>
<width>1037</width>
<height>630</height>
</rect>
</property>
Expand All @@ -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">
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -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>
Expand Down
12 changes: 12 additions & 0 deletions src/PreferencesDialog.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

Back | FazBrowse Home | New Git URL