KColumnResizer

Search for usage in LXR

#include <KColumnResizer>

Inheritance diagram for KColumnResizer:

Public Member Functions

 KColumnResizer (QObject *parent=nullptr)
 
void addWidget (QWidget *widget)
 
void addWidgetsFromLayout (QLayout *layout, int column=0)
 
void removeWidget (QWidget *widget)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Protected Member Functions

bool eventFilter (QObject *, QEvent *event) override
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QObject
typedef QObjectList
 

Detailed Description

Maintains consistent column sizes across layouts.

KColumnResizer is a helper class which can force columns of different layouts to keep the same width. It is useful to keep label columns consistent.

It works with QGridLayout and QFormLayout.

kcolumnresizer.png
left: without KColumnResizer - right: with KColumnResizer

Here is a typical example:

void Window::createWidgets()
{
QVBoxLayout *layout = new QVBoxLayout(this);
QGroupBox *box1 = new QGroupBox();
// Fill box1
// ...
layout->addWidget(box1);
QGroupBox *box2 = new QGroupBox();
// Fill box2
// ...
layout->addWidget(box2);
KColumnResizer *resizer = new KColumnResizer(this);
resizer->addWidgetsFromLayout(box1->layout(), 0);
resizer->addWidgetsFromLayout(box2->layout(), 0);
}

In this example box1 and box2 children can be organized using QGridLayout or QFormLayout, resizer will ensure the first columns of the two QGroupBox stay the same width.

Author
Aurélien Gâteau agate[email protected][email protected][email protected]de.or[email protected]g
Since
5.1

Definition at line 65 of file kcolumnresizer.h.

Constructor & Destructor Documentation

KColumnResizer::KColumnResizer ( QObject parent = nullptr)
explicit

Constructs a KColumnResizer.

Definition at line 172 of file kcolumnresizer.cpp.

Member Function Documentation

void KColumnResizer::addWidget ( QWidget widget)

Add a single widget to the list of widgets whose width is monitored.

It is more common to use addWidgetsFromLayout(), but adding single widgets can be useful if you want to keep a single button the same width as a column in a layout.

Parameters
widgetThe widget to add

Definition at line 180 of file kcolumnresizer.cpp.

void KColumnResizer::addWidgetsFromLayout ( QLayout layout,
int  column = 0 
)

Add all widgets from layout which are in column column to the list of widgets to manage.

Parameters
layoutThe layout containing the widgets to add. KColumnResizer supports QGridLayout and QFormLayout.
columnThe column number which contains the widgets. If layout is a QFormLayout, column should not be higher than QFormLayout::SpanningRole

Definition at line 207 of file kcolumnresizer.cpp.

void KColumnResizer::removeWidget ( QWidget widget)

Remove a widget previously added by addWidget or addWidgetsFromLayout.

Parameters
widgetThe widget to remove

Definition at line 190 of file kcolumnresizer.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Jun 18 2021 22:44:09 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.