MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / GetMonitorNames

Function GetMonitorNames

plugins/base/utils/monitor-helpers.cpp:10–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8namespace advss {
9
10QStringList GetMonitorNames()
11{
12 QStringList monitorNames;
13 QList<QScreen *> screens = QGuiApplication::screens();
14 for (int i = 0; i < screens.size(); i++) {
15 QScreen *screen = screens[i];
16 QRect screenGeometry = screen->geometry();
17 qreal ratio = screen->devicePixelRatio();
18 QString name = "";
19#if defined(__APPLE__) || defined(_WIN32)
20 name = screen->name();
21#else
22 name = screen->model().simplified();
23 if (name.length() > 1 && name.endsWith("-")) {
24 name.chop(1);
25 }
26#endif
27 name = name.simplified();
28
29 if (name.length() == 0) {
30 name = QString("%1 %2")
31 .arg(obs_module_text(
32 "AdvSceneSwitcher.action.projector.display"))
33 .arg(QString::number(i + 1));
34 }
35 QString str =
36 QString("%1: %2x%3 @ %4,%5")
37 .arg(name,
38 QString::number(screenGeometry.width() *
39 ratio),
40 QString::number(screenGeometry.height() *
41 ratio),
42 QString::number(screenGeometry.x()),
43 QString::number(screenGeometry.y()));
44
45 monitorNames << str;
46 }
47 return monitorNames;
48}
49
50MonitorSelectionWidget::MonitorSelectionWidget(QWidget *parent)
51 : FilterComboBox(parent)

Callers 7

SetMonitorMethod · 0.85
MonitorSetupChangedMethod · 0.85
getMonitorSizeFunction · 0.85
matchDisplayNamesFunction · 0.85
showEventMethod · 0.85

Calls 5

obs_module_textFunction · 0.85
sizeMethod · 0.80
modelMethod · 0.80
widthMethod · 0.80
nameMethod · 0.45

Tested by

no test coverage detected