MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / TOPPViewBase

Method TOPPViewBase

src/openms_gui/source/VISUAL/APPLICATIONS/TOPPViewBase.cpp:89–439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87 FileTypes::MSP, FileTypes::BZ2, FileTypes::GZ });
88
89 TOPPViewBase::TOPPViewBase(TOOL_SCAN scan_mode, VERBOSITY verbosity, QWidget* parent) :
90 QMainWindow(parent),
91 DefaultParamHandler("TOPPViewBase"),
92 scan_mode_(scan_mode),
93 verbosity_(verbosity),
94 ws_(this),
95 tab_bar_(this),
96 recent_files_(),
97 menu_(this, &ws_, &recent_files_)
98 {
99 setWindowTitle("TOPPView");
100 setWindowIcon(QIcon(":/TOPPView.png"));
101 setMinimumSize(400, 400); // prevents errors caused by too small width, height values
102 setAcceptDrops(true); // enable drag-and-drop
103
104 // get geometry of first screen
105 QRect screen_geometry = QGuiApplication::primaryScreen()->geometry();
106 // center main window
107 setGeometry(
108 (int)(0.1 * screen_geometry.width()),
109 (int)(0.1 * screen_geometry.height()),
110 (int)(0.8 * screen_geometry.width()),
111 (int)(0.8 * screen_geometry.height())
112 );
113
114 //################## Main Window #################
115 // Create main workspace using a QVBoxLayout ordering the items vertically
116 // (the tab bar and the main workspace). Uses a dummy central widget (to be able to
117 // have a layout), then adds vertically the tab bar and workspace.
118 QWidget* dummy_cw = new QWidget(this);
119 setCentralWidget(dummy_cw);
120 QVBoxLayout* box_layout = new QVBoxLayout(dummy_cw);
121
122 // create empty tab bar and workspace which will hold the main visualization widgets (e.g. spectrawidgets...)
123 tab_bar_.setWhatsThis("Tab bar<BR><BR>Close tabs through the context menu or by double-clicking them.<BR>The tab bar accepts drag-and-drop from the layer bar.");
124 tab_bar_.addTab("dummy", 4710);
125 tab_bar_.setMinimumSize(tab_bar_.sizeHint());
126 tab_bar_.removeId(4710);
127 connect(&tab_bar_, &EnhancedTabBar::currentIdChanged, this, &TOPPViewBase::showWindow);
128 connect(&tab_bar_, &EnhancedTabBar::closeRequested, this, &TOPPViewBase::closeByTab);
129 connect(&tab_bar_, &EnhancedTabBar::dropOnWidget, [this](const QMimeData* data, QWidget* source){ copyLayer(data, source); });
130 connect(&tab_bar_, &EnhancedTabBar::dropOnTab, this, &TOPPViewBase::copyLayer);
131 box_layout->addWidget(&tab_bar_);
132
133 // Trigger updates only when the active subWindow changes and update it
134 connect(&ws_, &EnhancedWorkspace::subWindowActivated, [this](QMdiSubWindow* window) {
135 if (window && lastActiveSubwindow_ != window) /* 0 upon terminate */ updateBarsAndMenus();
136 lastActiveSubwindow_ = window;
137 });
138 connect(&ws_, &EnhancedWorkspace::dropReceived, this, &TOPPViewBase::copyLayer);
139 box_layout->addWidget(&ws_);
140
141 //################## STATUS #################
142 // create status bar
143 message_label_ = new QLabel(statusBar());
144 statusBar()->addWidget(message_label_, 1);
145
146 x_label_ = new QLabel("RT: 12345678", statusBar());

Callers

nothing calls this directly

Calls 15

widthMethod · 0.80
heightMethod · 0.80
addTabMethod · 0.80
sizeHintMethod · 0.80
removeIdMethod · 0.80
setTextMethod · 0.80
showMethod · 0.80
frontMethod · 0.80
addWindowToggleMethod · 0.80
setFiltersMethod · 0.80
setVerboseMethod · 0.80
setPluginPathMethod · 0.80

Tested by

no test coverage detected