MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / build_cursor_pannel

Method build_cursor_pannel

DSView/pv/dock/measuredock.cpp:849–908  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

847}
848
849void MeasureDock::build_cursor_pannel()
850{
851 auto mode_rows = get_mode_rows();
852
853 for (auto &row : mode_rows->_opt_row_list)
854 {
855 if (row.del_bt != NULL){
856 row.del_bt->deleteLater();
857 row.goto_bt->deleteLater();
858 row.info_label->deleteLater();
859 }
860 }
861 mode_rows->_opt_row_list.clear();
862
863 QFont font = this->font();
864 font.setPointSizeF(AppConfig::Instance().appOptions.fontSize);
865
866 QLabel cal_lb;
867 cal_lb.setFont(font);
868 int bt_w = cal_lb.fontMetrics().horizontalAdvance("22") + 8;
869
870 int index = 1;
871 int cursor_dex = 0;
872 QString iconPath = GetIconPath();
873 auto &cursor_list = _view.get_cursorList();
874
875 if (cursor_list.size() == 0){
876 return;
877 }
878
879 for(auto it = cursor_list.begin(); it != cursor_list.end(); it++) {
880 XToolButton *del_btn = new XToolButton(_widget);
881 del_btn->setIcon(QIcon(iconPath+"/del.svg"));
882 del_btn->setCheckable(true);
883 QPushButton *cursor_pushButton = new QPushButton(QString::number(index), _widget);
884 set_cursor_btn_color(cursor_pushButton);
885
886 QString cur_pos = _view.get_cm_time(cursor_dex) + "/"
887 + QString::number(_view.get_cursor_samples(cursor_dex));
888 QLabel *curpos_label = new QLabel(cur_pos, _widget);
889
890 _cursor_layout->addWidget(del_btn, 1+index, 0);
891 _cursor_layout->addWidget(cursor_pushButton, 1 + index, 1);
892 _cursor_layout->addWidget(curpos_label, 1 + index, 2);
893 curpos_label->setFont(font);
894 cursor_pushButton->setFont(font);
895 cursor_pushButton->setFixedWidth(bt_w);
896
897 connect(del_btn, SIGNAL(clicked()), this, SLOT(del_cursor()));
898 connect(cursor_pushButton, SIGNAL(clicked()), this, SLOT(goto_cursor()));
899
900 cursor_opt_info inf = {del_btn, cursor_pushButton, curpos_label, (*it)};
901 mode_rows->_opt_row_list.push_back(inf);
902
903 index++;
904 cursor_dex++;
905 }
906

Callers

nothing calls this directly

Calls 6

GetIconPathFunction · 0.85
sizeMethod · 0.80
get_cm_timeMethod · 0.80
get_cursor_samplesMethod · 0.80
clearMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected