swift
Loading...
Searching...
No Matches
namevariantpairview.cpp
1// SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#include <QtGlobal>
7
9
10using namespace swift::misc;
11using namespace swift::gui::models;
12
13namespace swift::gui::views
14{
20
22 {
23 Q_ASSERT(m_model);
24 m_model->setIconMode(withIcon);
25 }
26
28 const CIcon &icon, bool resize, bool skipEqualValues)
29 {
30 Q_ASSERT(m_model);
31 bool changed = m_model->addOrUpdateByName(name, value, icon, skipEqualValues);
32 if (resize && changed)
33 {
34 this->resizeToContents();
35 }
36 return changed;
37 }
38
40 {
41 m_model->removeByName(name);
42 if (resize)
43 {
44 this->resizeToContents();
45 }
46 }
47
48 bool CNameVariantPairView::containsName(const QString &name) { return m_model->containsName(name); }
49} // namespace swift::gui::views
Simple model displaying name / variant values.
void removeByName(const QString &name, bool isResizeConditionMet=true)
Remove by name.
void setIconMode(bool withIcon)
Icon mode.
bool addOrUpdateByName(const QString &name, const swift::misc::CVariant &value, const swift::misc::CIcon &icon=swift::misc::CIcon(), bool isResizeConditionMet=true, bool skipEqualValues=true)
Update or add value, QVariant version.
bool containsName(const QString &name)
Contains name.
CNameVariantPairView(QWidget *parent=nullptr)
Constructor.
CViewBase(QWidget *parent, ModelClass *model=nullptr)
Definition viewbase.cpp:31
bool m_forceStretchLastColumnWhenResized
a small table might (few columns) fail stretching, force again
Definition viewbase.h:590
virtual void resizeToContents()
Resize to contents, strategy depends on container size.
Value object for icons. An icon is stored in the global icon repository and identified by its index....
Definition icon.h:39
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
Definition variant.h:69
Models to be used with views, mainly QTableView.
Views, mainly QTableView.
Free functions in swift::misc.
QObject * parent() const const
void resize(const QSize &)