MCPcopy Create free account
hub / github.com/deskflow/deskflow / ScreenSetupModel

Method ScreenSetupModel

src/lib/gui/ScreenSetupModel.cpp:19–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17const QString ScreenSetupModel::m_MimeType = "application/x-deskflow-screen";
18
19ScreenSetupModel::ScreenSetupModel(ScreenList &screens, int numColumns, int numRows)
20 : QAbstractTableModel(nullptr),
21 m_Screens(screens),
22 m_NumColumns(numColumns),
23 m_NumRows(numRows)
24{
25
26 // bound rows and columns to prevent multiply overflow.
27 // this is unlikely to happen, as the grid size is only 3x9.
28 if (m_NumColumns > 100 || m_NumRows > 100) {
29 qFatal("grid size out of bounds: %d columns x %d rows", m_NumColumns, m_NumRows);
30 return;
31 }
32
33 const long span = static_cast<long>(m_NumColumns) * m_NumRows;
34 if (span > screens.size()) {
35 qFatal("scrren list (%lld) too small for %d columns x %d rows", screens.size(), m_NumColumns, m_NumRows);
36 }
37}
38
39QVariant ScreenSetupModel::data(const QModelIndex &index, int role) const
40{

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected