Skip to content

Commit

Permalink
ENH: Implement right-aligned text in QPlainTextEdit without a subclas…
Browse files Browse the repository at this point in the history
…s. #2153
  • Loading branch information
Woundorf committed Apr 13, 2022
1 parent c14ec28 commit c3edd84
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 124 deletions.
1 change: 0 additions & 1 deletion starviewer/src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ set(SOURCES
qopacitytransferfunctiongraphicalview.cpp
qopacitytransferfunctiongraphicalviewline.cpp
qopacitytransferfunctiongraphicalviewnode.cpp
qplaintextedit2.cpp
qreleasenotes.cpp
qscreendistribution.cpp
qscrollareawithbettersizehint.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ Q2DViewerAnnotationsConfigurationWidget::Q2DViewerAnnotationsConfigurationWidget
{
setupUi(this);

m_topLeftPlainTextEdit->setAlignment(Qt::AlignLeft);
m_topRightPlainTextEdit->setAlignment(Qt::AlignRight);
m_bottomLeftPlainTextEdit->setAlignment(Qt::AlignLeft);
m_bottomRightPlainTextEdit->setAlignment(Qt::AlignRight);
// Set text right-aligned in right text edits
QTextOption option = m_topRightPlainTextEdit->document()->defaultTextOption();
option.setAlignment(Qt::AlignRight);
m_topRightPlainTextEdit->document()->setDefaultTextOption(option);
m_bottomRightPlainTextEdit->document()->setDefaultTextOption(option);

m_modalityLabel->setVisible(modality != "Default");
m_modalityLineEdit->setVisible(modality != "Default");
Expand Down
19 changes: 6 additions & 13 deletions starviewer/src/core/q2dviewerannotationsconfigurationwidgetbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -170,28 +170,28 @@
</layout>
</item>
<item row="1" column="0">
<widget class="udg::QPlainTextEdit2" name="m_topLeftPlainTextEdit">
<widget class="QPlainTextEdit" name="m_topLeftPlainTextEdit">
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="udg::QPlainTextEdit2" name="m_topRightPlainTextEdit">
<widget class="QPlainTextEdit" name="m_topRightPlainTextEdit">
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="udg::QPlainTextEdit2" name="m_bottomLeftPlainTextEdit">
<item row="3" column="1">
<widget class="QPlainTextEdit" name="m_bottomRightPlainTextEdit">
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="udg::QPlainTextEdit2" name="m_bottomRightPlainTextEdit">
<item row="3" column="0">
<widget class="QPlainTextEdit" name="m_bottomLeftPlainTextEdit">
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
Expand Down Expand Up @@ -236,13 +236,6 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>udg::QPlainTextEdit2</class>
<extends>QPlainTextEdit</extends>
<header>qplaintextedit2.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../main/themes/starviewer/starviewer.qrc"/>
</resources>
Expand Down
53 changes: 0 additions & 53 deletions starviewer/src/core/qplaintextedit2.cpp

This file was deleted.

53 changes: 0 additions & 53 deletions starviewer/src/core/qplaintextedit2.h

This file was deleted.

0 comments on commit c3edd84

Please sign in to comment.