mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Dynamic text field editor : move kcolorbutton from ui file to cpp file
Kcolorbutton is not available in Qt6 for now. We move it from the ui file to the cpp file for choose at compilation if qet must use kcolorbutton or not.
This commit is contained in:
@@ -32,13 +32,16 @@
|
||||
#include <QPointer>
|
||||
#include <assert.h>
|
||||
|
||||
DynamicTextFieldEditor::DynamicTextFieldEditor(
|
||||
QETElementEditor *editor, PartDynamicTextField *text_field, QWidget *parent) :
|
||||
DynamicTextFieldEditor::DynamicTextFieldEditor(QETElementEditor *editor,
|
||||
PartDynamicTextField *text_field,
|
||||
QWidget *parent) :
|
||||
ElementItemEditor(editor, parent),
|
||||
ui(new Ui::DynamicTextFieldEditor) {
|
||||
ui(new Ui::DynamicTextFieldEditor)
|
||||
{
|
||||
ui -> setupUi(this);
|
||||
ui -> m_composite_text_pb -> setDisabled(true);
|
||||
ui -> m_elmt_info_cb -> setDisabled(true);
|
||||
setupWidget();
|
||||
if(text_field) {
|
||||
setPart(text_field);
|
||||
}
|
||||
@@ -137,7 +140,7 @@ void DynamicTextFieldEditor::updateForm()
|
||||
ui -> m_size_sb -> setValue(m_text_field.data() -> font().pointSize());
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
ui -> m_color_kpb -> setColor(m_text_field.data() -> color());
|
||||
m_color_kpb -> setColor(m_text_field.data() -> color());
|
||||
#endif
|
||||
ui -> m_width_sb -> setValue(m_text_field.data() -> textWidth());
|
||||
ui -> m_font_pb -> setText(m_text_field -> font().family());
|
||||
@@ -162,6 +165,20 @@ void DynamicTextFieldEditor::updateForm()
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::setupWidget()
|
||||
{
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
m_color_kpb = new KColorButton(this);
|
||||
m_color_kpb->setObjectName(QString::fromUtf8("m_color_kpb"));
|
||||
|
||||
connect(m_color_kpb, &KColorButton::changed,
|
||||
this, &DynamicTextFieldEditor::on_m_color_kpb_changed);
|
||||
|
||||
ui->m_main_grid_layout->addWidget(m_color_kpb, 7, 1, 1, 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DynamicTextFieldEditor::setUpConnections()
|
||||
{
|
||||
assert(m_connection_list.isEmpty());
|
||||
|
||||
@@ -21,6 +21,11 @@
|
||||
#include "../elementitemeditor.h"
|
||||
#include "../graphicspart/partdynamictextfield.h"
|
||||
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
# include <KColorButton>
|
||||
#endif
|
||||
|
||||
namespace Ui {
|
||||
class DynamicTextFieldEditor;
|
||||
}
|
||||
@@ -43,6 +48,7 @@ class DynamicTextFieldEditor : public ElementItemEditor {
|
||||
void updateForm() override;
|
||||
|
||||
private:
|
||||
void setupWidget();
|
||||
void fillInfoComboBox();
|
||||
void setUpConnections();
|
||||
void disconnectConnections();
|
||||
@@ -68,6 +74,11 @@ class DynamicTextFieldEditor : public ElementItemEditor {
|
||||
QPointer<PartDynamicTextField> m_text_field;
|
||||
QList<PartDynamicTextField*> m_parts;
|
||||
QList<QMetaObject::Connection> m_connection_list;
|
||||
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
KColorButton* m_color_kpb = nullptr;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // DYNAMICTEXTFIELDEDITOR_H
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<layout class="QGridLayout" name="m_main_grid_layout">
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="m_text_from_cb">
|
||||
<item>
|
||||
@@ -206,18 +206,8 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="2">
|
||||
<widget class="KColorButton" name="m_color_kpb"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KColorButton</class>
|
||||
<extends>QPushButton</extends>
|
||||
<header>kcolorbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user