forked from Ivasoft/DSView
Set font for context menu on scope view
This commit is contained in:
@@ -253,6 +253,7 @@ namespace pv
|
||||
AppControl::Instance()->add_font_form(_measure_widget);
|
||||
AppControl::Instance()->add_font_form(_search_widget);
|
||||
AppControl::Instance()->add_font_form(_trigger_widget);
|
||||
AppControl::Instance()->add_font_form(_view->get_time_view());
|
||||
|
||||
// event
|
||||
connect(&_event, SIGNAL(session_error()), this, SLOT(on_session_error()));
|
||||
@@ -335,6 +336,7 @@ namespace pv
|
||||
_protocol_dock->setWindowTitle(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_PROTOCOL_DOCK_TITLE), "Decode Protocol"));
|
||||
_measure_dock->setWindowTitle(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_MEASURE_DOCK_TITLE), "Measurement"));
|
||||
_search_dock->setWindowTitle(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_SEARCH_DOCK_TITLE), "Search..."));
|
||||
_view->get_time_view()->update_lang();
|
||||
}
|
||||
|
||||
void MainWindow::on_load_file(QString file_name)
|
||||
@@ -2058,7 +2060,7 @@ namespace pv
|
||||
break;
|
||||
|
||||
case DSV_MSG_FONT_OPTIONS_CHANGED:
|
||||
AppControl::Instance()->update_font_forms();
|
||||
AppControl::Instance()->update_font_forms();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,6 +315,10 @@ public:
|
||||
signals_changed();
|
||||
}
|
||||
|
||||
inline Viewport* get_time_view(){
|
||||
return _time_viewport;
|
||||
}
|
||||
|
||||
signals:
|
||||
void hover_point_changed();
|
||||
void cursor_update();
|
||||
|
||||
@@ -102,12 +102,14 @@ Viewport::Viewport(View &parent, View_type type) :
|
||||
_cmenu = new QMenu(this);
|
||||
QAction *yAction = _cmenu->addAction(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_ADD_Y_CURSOR), "Add Y-cursor"));
|
||||
QAction *xAction = _cmenu->addAction(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_ADD_X_CURSOR), "Add X-cursor"));
|
||||
_yAction = yAction;
|
||||
_xAction = xAction;
|
||||
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
this->update_font();
|
||||
|
||||
connect(&_trigger_timer, SIGNAL(timeout()),this, SLOT(on_trigger_timer()));
|
||||
connect(&_drag_timer, SIGNAL(timeout()),this, SLOT(on_drag_timer()));
|
||||
|
||||
connect(yAction, SIGNAL(triggered(bool)), this, SLOT(add_cursor_y()));
|
||||
connect(xAction, SIGNAL(triggered(bool)), this, SLOT(add_cursor_x()));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)),this, SLOT(show_contextmenu(const QPoint&)));
|
||||
@@ -1948,6 +1950,19 @@ void Viewport::add_cursor_x()
|
||||
_view.show_xcursors(true);
|
||||
}
|
||||
|
||||
void Viewport::update_font()
|
||||
{
|
||||
QFont font = this->font();
|
||||
font.setPointSizeF(AppConfig::Instance().appOptions.fontSize);
|
||||
_yAction->setFont(font);
|
||||
_xAction->setFont(font);
|
||||
}
|
||||
|
||||
void Viewport::update_lang()
|
||||
{
|
||||
_yAction->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_ADD_Y_CURSOR), "Add Y-cursor"));
|
||||
_xAction->setText(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_ADD_X_CURSOR), "Add X-cursor"));
|
||||
}
|
||||
|
||||
} // namespace view
|
||||
} // namespace pv
|
||||
|
||||
@@ -35,10 +35,12 @@
|
||||
|
||||
#include "../view/view.h"
|
||||
#include "../dsvdef.h"
|
||||
#include "../interface/icallbacks.h"
|
||||
|
||||
class QPainter;
|
||||
class QPaintEvent;
|
||||
class SigSession;
|
||||
class QAction;
|
||||
|
||||
using std::chrono::high_resolution_clock;
|
||||
using std::chrono::milliseconds;
|
||||
@@ -52,7 +54,7 @@ class View;
|
||||
//main graph view port, in the middle region
|
||||
//draw the left and right rule scale
|
||||
//created by View
|
||||
class Viewport : public QWidget
|
||||
class Viewport : public QWidget, public IFontForm
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -107,6 +109,11 @@ public:
|
||||
void unshow_wait_trigger();
|
||||
void show_wait_trigger();
|
||||
|
||||
void update_lang();
|
||||
|
||||
//IFontForm
|
||||
void update_font();
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event) override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
@@ -217,6 +224,8 @@ private:
|
||||
|
||||
high_resolution_clock::time_point _lst_wait_tigger_time;
|
||||
int _tigger_wait_times;
|
||||
QAction *_yAction;
|
||||
QAction *_xAction;
|
||||
};
|
||||
|
||||
} // namespace view
|
||||
|
||||
Reference in New Issue
Block a user