Experimental QTextEdit widget in Reader framework

Works much better, that's for sure
This commit is contained in:
Nicolas Mailloux 2021-06-10 19:43:00 -04:00
parent 762489bb6b
commit 7c03591c94
3 changed files with 394 additions and 394 deletions

View file

@ -235,7 +235,7 @@ reader::reader(QWidget *parent) :
}
// Word selection & dictionary lookup feature
QString dictionary_position_str = QString::number(dictionary_position);
/*QString dictionary_position_str = QString::number(dictionary_position);
ui->definitionStatusLabel->setText(dictionary_position_str);
QTimer *select_t = new QTimer(this);
select_t->setInterval(100);
@ -271,7 +271,7 @@ reader::reader(QWidget *parent) :
;
}
} );
select_t->start();
select_t->start();*/
// We have to get the file's path
if(global::reader::skipOpenDialog == true) {

778
reader.ui
View file

@ -16,6 +16,114 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="10" column="0">
<widget class="QTextEdit" name="text">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>100</horstretch>
<verstretch>100</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
</widget>
</item>
<item row="17" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="4">
<widget class="Line" name="line_3">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="previousBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Previous</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Line" name="line">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="optionsBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="nextBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Next</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="hideOptionsBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Hide</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="9" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="16" column="0">
<widget class="Line" name="line_2">
<property name="frameShadow">
@ -29,6 +137,287 @@
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QStackedWidget" name="wordWidget">
<widget class="QWidget" name="page_8">
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="Line" name="line_12">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>8</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_5">
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="1" column="3">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="saveWordBtn">
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="infoCloseBtn">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="wordSearchLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Word search</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_12">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_14">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="2">
<widget class="Line" name="line_14">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>2</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="definitionLabel">
<property name="font">
<font>
<family>Source Serif Pro</family>
</font>
</property>
<property name="text">
<string>Definition</string>
</property>
<property name="alignment">
<set>Qt::AlignJustify|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="wordLabel">
<property name="font">
<font>
<family>Inter</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Word</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0">
<layout class="QGridLayout" name="gridLayout_9">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="previousDefinitionBtn">
<property name="text">
<string>Previous</string>
</property>
</widget>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QLabel" name="definitionStatusLabel">
<property name="text">
<string>Status</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="nextDefinitionBtn">
<property name="text">
<string>Next</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_13">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>8</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_9"/>
</widget>
</item>
<item row="8" column="0">
<widget class="QStackedWidget" name="menuWidget">
<widget class="QWidget" name="page_20">
@ -589,287 +978,6 @@
<widget class="QWidget" name="page_21"/>
</widget>
</item>
<item row="12" column="0">
<widget class="QStackedWidget" name="wordWidget">
<widget class="QWidget" name="page_8">
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="Line" name="line_12">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>8</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_5">
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="1" column="3">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="saveWordBtn">
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="infoCloseBtn">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="wordSearchLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Word search</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_12">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_14">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="2">
<widget class="Line" name="line_14">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>2</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="definitionLabel">
<property name="font">
<font>
<family>Source Serif Pro</family>
</font>
</property>
<property name="text">
<string>Definition</string>
</property>
<property name="alignment">
<set>Qt::AlignJustify|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="wordLabel">
<property name="font">
<font>
<family>Inter</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Word</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0">
<layout class="QGridLayout" name="gridLayout_9">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="previousDefinitionBtn">
<property name="text">
<string>Previous</string>
</property>
</widget>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QLabel" name="definitionStatusLabel">
<property name="text">
<string>Status</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="nextDefinitionBtn">
<property name="text">
<string>Next</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_13">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>8</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_9"/>
</widget>
</item>
<item row="11" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
@ -883,114 +991,6 @@
</property>
</spacer>
</item>
<item row="17" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="4">
<widget class="Line" name="line_3">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="previousBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Previous</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Line" name="line">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="optionsBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Options</string>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="nextBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Next</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="hideOptionsBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Hide</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="10" column="0">
<widget class="QLabel" name="text">
<property name="font">
<font>
<family>Ubuntu</family>
<italic>false</italic>
</font>
</property>
<property name="text">
<string>Text</string>
</property>
<property name="alignment">
<set>Qt::AlignJustify|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>

View file

@ -193,17 +193,17 @@ QLineEdit:edit-focus, QSpinBox:edit-focus, QDoubleSpinBox:edit-focus
QTextEdit
{
background-color:transparent;
border:1px solid black;
border: 0;
padding: 1px;
}
QTextEdit:focus
{
border: 1px solid black;
border: 0;
padding: 1px;
}
QTextEdit:edit-focus
{
border: 3px solid black;
border: 0;
padding: 0px;
}