Show document title at the top of line edit
It takes more space but just looks better.
This commit is contained in:
parent
82e8d28bdd
commit
976bcbb2e8
|
@ -284,15 +284,15 @@ void TagEditorWidget::updateDocumentTitleEdits()
|
|||
const vector<string> &titles = container ? container->titles() : vector<string>();
|
||||
|
||||
// get layout
|
||||
QLayout *docTitleLayout = m_ui->docTitleWidget->layout();
|
||||
int lineEditCount = docTitleLayout->count() - 1;
|
||||
QLayout *const docTitleLayout = m_ui->docTitleWidget->layout();
|
||||
int lineEditCount = docTitleLayout->count();
|
||||
|
||||
// update existing line edits, remove unneeded line edits
|
||||
int i = 0;
|
||||
for (; i < lineEditCount; ++i) {
|
||||
if (i < segmentCount) {
|
||||
// update existing line edit
|
||||
static_cast<ClearLineEdit *>(docTitleLayout->itemAt(i + 1)->widget())
|
||||
static_cast<ClearLineEdit *>(docTitleLayout->itemAt(i)->widget())
|
||||
->setText(static_cast<size_t>(i) < titles.size() ? QString::fromUtf8(titles[static_cast<size_t>(i)].data()) : QString());
|
||||
} else {
|
||||
// remove unneeded line edit
|
||||
|
@ -475,13 +475,15 @@ void TagEditorWidget::updateTagSelectionComboBox()
|
|||
*/
|
||||
void TagEditorWidget::updateFileStatusStatus()
|
||||
{
|
||||
bool opened = m_fileInfo.isOpen();
|
||||
bool hasTag = opened && m_tags.size();
|
||||
const bool opened = m_fileInfo.isOpen();
|
||||
const bool hasTag = opened && m_tags.size();
|
||||
// notification widgets
|
||||
m_ui->parsingNotificationWidget->setVisible(opened);
|
||||
m_ui->makingNotificationWidget->setVisible(opened && (m_makingResultsAvailable));
|
||||
// document title widget
|
||||
m_ui->docTitleWidget->setVisible(opened && m_fileInfo.container() && m_fileInfo.container()->supportsTitle());
|
||||
const bool showDocumentTitle = opened && m_fileInfo.container() && m_fileInfo.container()->supportsTitle();
|
||||
m_ui->docTitleLabel->setVisible(showDocumentTitle);
|
||||
m_ui->docTitleWidget->setVisible(showDocumentTitle);
|
||||
// buttons and actions to save, delete, close
|
||||
m_ui->saveButton->setEnabled(opened);
|
||||
m_ui->nextButton->setEnabled(opened);
|
||||
|
@ -1037,12 +1039,11 @@ bool TagEditorWidget::applyEntriesAndSaveChangings()
|
|||
m_makingResultsAvailable = true;
|
||||
|
||||
// apply titles
|
||||
if (AbstractContainer *container = m_fileInfo.container()) {
|
||||
if (container->supportsTitle()) {
|
||||
QLayout *docTitleLayout = m_ui->docTitleWidget->layout();
|
||||
for (int i = 0, count = min<int>(docTitleLayout->count() - 1, container->segmentCount()); i < count; ++i) {
|
||||
container->setTitle(static_cast<ClearLineEdit *>(docTitleLayout->itemAt(i + 1)->widget())->text().toUtf8().data(), i);
|
||||
}
|
||||
AbstractContainer *const container = m_fileInfo.container();
|
||||
if (container && container->supportsTitle()) {
|
||||
QLayout *const docTitleLayout = m_ui->docTitleWidget->layout();
|
||||
for (std::size_t i = 0, count = min<std::size_t>(static_cast<std::size_t>(docTitleLayout->count()), container->segmentCount()); i < count; ++i) {
|
||||
container->setTitle(static_cast<ClearLineEdit *>(docTitleLayout->itemAt(static_cast<int>(i))->widget())->text().toUtf8().data(), i);
|
||||
}
|
||||
}
|
||||
// apply all tags
|
||||
|
|
|
@ -54,6 +54,13 @@
|
|||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="docTitleLabel">
|
||||
<property name="text">
|
||||
<string>Document title</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="docTitleWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
|
@ -75,18 +82,11 @@
|
|||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="docTitleLabel">
|
||||
<property name="text">
|
||||
<string>Document title</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="" native="true">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -94,6 +94,15 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="tagSelectionHorizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="tagSelectionComboBox">
|
||||
<property name="sizePolicy">
|
||||
|
@ -231,6 +240,14 @@ currently shown tag.</string>
|
|||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>678</width>
|
||||
<height>0</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
|
|
Loading…
Reference in New Issue