mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2025-09-23 08:39:07 +03:00
ObjectInspector for dark themes has been fixed
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "lrintpropitem.h"
|
||||
#include <limits>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
namespace{
|
||||
LimeReport::ObjectPropItem * createIntPropItem(
|
||||
@@ -44,21 +45,27 @@ namespace LimeReport{
|
||||
|
||||
QWidget *IntPropItem::createProperyEditor(QWidget *parent) const
|
||||
{
|
||||
QSpinBox *editor= new QSpinBox(parent);
|
||||
editor->setMaximum(std::numeric_limits<int>::max());
|
||||
editor->setMinimum(std::numeric_limits<int>::min());
|
||||
return editor;
|
||||
// QWidget* base = new QWidget(parent);
|
||||
// QHBoxLayout* layout = new QHBoxLayout();
|
||||
// base->setLayout(layout);
|
||||
|
||||
// QSpinBox *editor = new QSpinBox(parent);
|
||||
// editor->setMaximum(std::numeric_limits<int>::max());
|
||||
// editor->setMinimum(std::numeric_limits<int>::min());
|
||||
|
||||
// layout->addWidget(editor);
|
||||
return new SpinBoxEditor(parent);
|
||||
}
|
||||
|
||||
void IntPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const
|
||||
{
|
||||
QSpinBox *editor =qobject_cast<QSpinBox *>(propertyEditor);
|
||||
SpinBoxEditor *editor =qobject_cast<SpinBoxEditor *>(propertyEditor);
|
||||
editor->setValue(propertyValue().toInt());
|
||||
}
|
||||
|
||||
void IntPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index)
|
||||
{
|
||||
model->setData(index,qobject_cast<QSpinBox*>(propertyEditor)->value());
|
||||
model->setData(index,qobject_cast<SpinBoxEditor*>(propertyEditor)->value());
|
||||
object()->setProperty(propertyName().toLatin1(),propertyValue());
|
||||
foreach(QObject* item, *objects()){
|
||||
if (item->metaObject()->indexOfProperty(propertyName().toLatin1())!=-1){
|
||||
@@ -67,4 +74,29 @@ void IntPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *mode
|
||||
}
|
||||
}
|
||||
|
||||
SpinBoxEditor::SpinBoxEditor(QWidget *parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
m_valueEditor = new QSpinBox(this);
|
||||
m_valueEditor->setMinimum(std::numeric_limits<int>::min());
|
||||
m_valueEditor->setMaximum(std::numeric_limits<int>::max());
|
||||
setFocusProxy(m_valueEditor);
|
||||
QHBoxLayout* hLayout = new QHBoxLayout(this);
|
||||
hLayout->addWidget(m_valueEditor);
|
||||
hLayout->setContentsMargins(1,1,1,1);
|
||||
hLayout->setSpacing(0);
|
||||
setAutoFillBackground(true);
|
||||
connect(m_valueEditor, SIGNAL(editingFinished()), this, SIGNAL(editingFinished()));
|
||||
}
|
||||
|
||||
int SpinBoxEditor::value()
|
||||
{
|
||||
return m_valueEditor->value();
|
||||
}
|
||||
|
||||
void SpinBoxEditor::setValue(int value)
|
||||
{
|
||||
m_valueEditor->setValue(value);
|
||||
}
|
||||
|
||||
} // namespace LimeReport
|
||||
|
@@ -31,8 +31,22 @@
|
||||
#define LRINTPROPITEM_H
|
||||
|
||||
#include "lrobjectpropitem.h"
|
||||
#include <QSpinBox>
|
||||
|
||||
namespace LimeReport {
|
||||
|
||||
class SpinBoxEditor : public QWidget{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SpinBoxEditor(QWidget* parent);
|
||||
int value();
|
||||
void setValue(int value);
|
||||
signals:
|
||||
void editingFinished();
|
||||
private:
|
||||
QSpinBox* m_valueEditor;
|
||||
};
|
||||
|
||||
class IntPropItem : public ObjectPropItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
Reference in New Issue
Block a user