• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ossia / score / 44990834010

22 Nov 2026 05:46AM UTC coverage: 61.818% (+0.2%) from 61.617%
44990834010

push

github

jcelerier
UI: the main window opens centred on the screen under the mouse and fits a 4K screen at 300%

The window was sized from the primary screen, while Qt opens it on the
screen under the mouse. When it did not fit there, Qt left it at logical
0,0, which a screen of another scale maps outside the desktop
(x=-10248 on a 100% primary with 300% screens beside it). It is now sized
from the screen it opens on and placed at its centre, with room kept for
the title bar, and on Wayland for a panel the compositor does not report:
three quarters of the screen, but at least 1000x680 when the screen allows.

The inspector and the object tree ask for 200 and 100 px instead of 400
and 160, so the window's minimum height drops from 744 to 484 logical px.
The start screen's header shrinks from 220 to 140 px on a window shorter
than 640, so the start screen fits down to 560: a 4K screen at 300% leaves
about 590 under the macOS menu bar, dock and title bar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdPgugz48pdcaqHJAg2vid

266655 of 799939 branches covered (33.33%)

36 of 38 new or added lines in 4 files covered. (94.74%)

3164 existing lines in 91 files now uncovered.

271878 of 439807 relevant lines covered (61.82%)

767748.57 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

26.32
/src/plugins/score-plugin-library/Library/ProcessTreeView.cpp
1
#include "ProcessTreeView.hpp"
2

3

4
#include <score/widgets/CursorTheme.hpp>
5
#include <score/widgets/Pixmap.hpp>
6
#if defined(__EMSCRIPTEN__)
7
#include <score/widgets/ItemViewDrag.hpp>
8

9
#include <QStyleOptionViewItem>
10
#endif
11

12
#include <QDrag>
13
#include <QGuiApplication>
14
#include <QMimeData>
15
#include <QMouseEvent>
16
#include <QSortFilterProxyModel>
17

18
#include <wobjectimpl.h>
19

20
W_OBJECT_IMPL(Library::ProcessTreeView)
55,618 !
21
namespace Library
22
{
23
Library::ProcessData* ProcessTreeView::dataFromViewIndex(QModelIndex idx)
17 ✔
24
{
25
  SCORE_ASSERT(idx.isValid());
17 !
26
  auto proxy = (QSortFilterProxyModel*)this->model();
17 ✔
27
  auto model_idx = proxy->mapToSource(idx);
17 ✔
28
  auto data = reinterpret_cast<TreeNode<ProcessData>*>(model_idx.internalPointer());
17 ✔
29
  return data;
17 ✔
30
}
31

UNCOV
32
void ProcessTreeView::reselect()
×
33
{
UNCOV
34
  if(auto* sm = selectionModel(); sm && !sm->selectedIndexes().isEmpty())
×
35
  {
UNCOV
36
    if(auto* data = dataFromViewIndex(sm->selectedIndexes().front()))
×
37
    {
38
      selected(*data);
×
UNCOV
39
      return;
×
40
    }
41
  }
×
42
  selected({});
×
UNCOV
43
}
×
44

45
void ProcessTreeView::selectionChanged(
3,356 ✔
46
    const QItemSelection& sel, const QItemSelection& desel)
47
{
48
  setDropIndicatorShown(true);
3,356 ✔
49

50
  if(!sel.isEmpty())
3,356 ✔
51
  {
52
    // guard against transient null internalPointer from async scan rebuild
53
    if(auto* data = dataFromViewIndex(sel.indexes().front()))
17 !
54
      selected(*data);
17 !
55
  }
17 ✔
56
  else if(desel.size() > 0)
3,339 !
57
  {
58
    selected({});
×
UNCOV
59
  }
×
60
}
3,356 ✔
61

UNCOV
62
QModelIndexList ProcessTreeView::selectedDraggableIndexes() const
×
63
{
64
  QModelIndexList indexes = selectedIndexes();
×
65
  auto m = QTreeView::model();
×
66
  auto isNotDragEnabled = [m](const QModelIndex& index) {
×
UNCOV
67
    return !(m->flags(index) & Qt::ItemIsDragEnabled);
×
68
  };
69
  indexes.erase(
×
70
      std::remove_if(indexes.begin(), indexes.end(), isNotDragEnabled), indexes.end());
×
71
  return indexes;
×
UNCOV
72
}
×
73

UNCOV
74
void ProcessTreeView::startDrag(Qt::DropActions)
×
75
{
76
  QModelIndexList indexes = selectedDraggableIndexes();
×
UNCOV
77
  if(indexes.count() == 1)
×
78
  {
79
    // auto proxy = (QSortFilterProxyModel*)this->model();
80
    // auto model_idx = proxy->mapFromSource(indexes.first());
81

82
    // QMimeData* data = proxy->mimeData(QModelIndexList{model_idx});
83
    QMimeData* data = QTreeView::model()->mimeData(indexes);
×
84
    if(!data)
×
UNCOV
85
      return;
×
86

87
    QDrag* drag = new QDrag(this);
×
UNCOV
88
    drag->setMimeData(data);
×
UNCOV
89
    score::CursorTheme::instance().setDragCursors(*drag);
×
90
#if defined(__EMSCRIPTEN__)
91
    QStyleOptionViewItem opt;
92
    initViewItemOption(&opt);
93
    score::setItemViewDragPixmap(*drag, *this, opt, indexes);
94
#endif
UNCOV
95
    drag->exec();
×
UNCOV
96
  }
×
UNCOV
97
}
×
98

99
void ProcessTreeView::mouseDoubleClickEvent(QMouseEvent* event)
×
100
{
101
  auto index = indexAt(event->pos());
×
UNCOV
102
  if(index.isValid())
×
103
  {
104
    // guard against transient null internalPointer from async scan rebuild
105
    auto data = dataFromViewIndex(index);
×
106
    if(data && data->key != UuidKey<Process::ProcessModel>{})
×
107
    {
UNCOV
108
      doubleClicked(*data);
×
109
      event->accept();
×
110
      return;
×
111
    }
112
  }
×
113
  QTreeView::mouseDoubleClickEvent(event);
×
114
}
×
115

116
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc