Commit 56b75e1d authored by Dimitris Kardarakos's avatar Dimitris Kardarakos

Prevent string cropping in bar widget and make practice button visible

In dashboard page, a couple of issues have been identified in collection widget.
1. When the translation of string "%1 word due" is slightly longer than the English one or %1 is a large number, string is cropped.
2. Practice button does not seem clickable, using the default breeze theme and reference theme of parley. Even worse, when breeze dark is used, due to the forcibly white background of collection widget, practice button text is unreadable.
I have addressed these issues by:
- Changing bar widget size to 2-lines, increasing also slightly the width of the collection widget
- Wrapping the text of bar widget
- Restoring theme colors to practice button (background was set to white due to collection widget white background)

REVIEW: 127561
parent 421abb09
......@@ -70,7 +70,7 @@ void BarWidget::paintEvent(QPaintEvent *)
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing, true);
const int legendWidth = COLLWIDTH - 10;
const int legendHeight = 20;
const int legendHeight = 45;
const int legendOffsetY = 0;
const int legendOffsetX = 0;
//const int alphaValueIncrement = 35;
......@@ -133,10 +133,10 @@ void BarWidget::paintEvent(QPaintEvent *)
//QPen pen(QColor(0, 0, 0));
painter.setPen(pen);
if (m_percentageCompleted < 100) {
painter.drawText(0, 0, legendWidth, 20, Qt::AlignCenter,
i18np("%1 word due", "%1 words due", m_totalDueWords));
painter.drawText(0, 0, legendWidth, legendHeight, Qt::AlignCenter | Qt::TextWordWrap,
i18np("%1 word due", "%1 word due", m_totalDueWords));
}
else {
painter.drawText(0, 0, legendWidth, 20, Qt::AlignCenter, i18n("Fully learned"));
painter.drawText(0, 0, legendWidth, legendHeight, Qt::AlignCenter | Qt::TextWordWrap, i18n("Fully learned"));
}
}
......@@ -36,10 +36,10 @@
// Size constants for the collection widgets
int COLLWIDTH = 140; // Width in pixels of a collection widget
int COLLWIDTH = 155; // Width in pixels of a collection widget
//int COLLHEIGHT1 = 250; // Height in pixels of a collection widget not yet fully learned
int COLLHEIGHT1 = 150; // Height in pixels of a collection widget not yet fully learned
int COLLHEIGHT2 = 100; // Height in pixels of a collection widget fully learned
int COLLHEIGHT1 = 175; // Height in pixels of a collection widget not yet fully learned
int COLLHEIGHT2 = 125; // Height in pixels of a collection widget fully learned
// ================================================================
......@@ -178,10 +178,13 @@ void CollectionWidget::setupWidget(WordCount *dueWords)
}
m_barWidget = new BarWidget(dueWords, this);
m_barWidget->setFixedSize(COLLWIDTH - 10, 20);
m_barWidget->setFixedSize(COLLWIDTH - 10, 45);
mainLayout->addWidget(m_barWidget);
m_practiceButton = new QPushButton(this);
m_practiceButton->setStyleSheet(QStringLiteral("QPushButton {border: none; margin: 0px; padding: 0px;}"));
QString buttonStyleSheet = "QPushButton { border: none; margin: 0px; padding: 0px; color: " +
palette.color(QPalette::Active, QPalette::ButtonText).name()+ "; background-color: " +
palette.color(QPalette::Active, QPalette::Button).name() + "; border-radius: 3px;}";
m_practiceButton->setStyleSheet(buttonStyleSheet);
// buttonLayout is the horizontal layout for the bottom line in the
// collection widget: delete button, practice button, etc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment