mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2024-10-06 06:50:16 +00:00
NOISSUE Try on fixing overflowing text
This commit is contained in:
parent
ce12f1a734
commit
b09f3448f9
@ -661,6 +661,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
|
|||||||
// Create the instance list widget
|
// Create the instance list widget
|
||||||
{
|
{
|
||||||
view = new GroupView(ui->centralWidget);
|
view = new GroupView(ui->centralWidget);
|
||||||
|
view->setTextElideMode(Qt::TextElideMode::ElideRight);
|
||||||
|
|
||||||
view->setSelectionMode(QAbstractItemView::SingleSelection);
|
view->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
// FIXME: leaks ListViewDelegate
|
// FIXME: leaks ListViewDelegate
|
||||||
|
@ -34,7 +34,6 @@ static void viewItemTextLayout(QTextLayout &textLayout, int lineWidth, qreal &he
|
|||||||
height = 0;
|
height = 0;
|
||||||
widthUsed = 0;
|
widthUsed = 0;
|
||||||
textLayout.beginLayout();
|
textLayout.beginLayout();
|
||||||
QString str = textLayout.text();
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
QTextLine line = textLayout.createLine();
|
QTextLine line = textLayout.createLine();
|
||||||
@ -190,11 +189,13 @@ void ListViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
|
|||||||
|
|
||||||
QStyle *style = opt.widget ? opt.widget->style() : QApplication::style();
|
QStyle *style = opt.widget ? opt.widget->style() : QApplication::style();
|
||||||
|
|
||||||
|
// FIXME: Things go really weird with long instance names
|
||||||
// const int iconSize = style->pixelMetric(QStyle::PM_IconViewIconSize);
|
// const int iconSize = style->pixelMetric(QStyle::PM_IconViewIconSize);
|
||||||
const int iconSize = 48;
|
const int iconSize = 48;
|
||||||
QRect iconbox = opt.rect;
|
QRect iconbox = opt.rect;
|
||||||
const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, opt.widget) + 1;
|
const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, opt.widget) + 1;
|
||||||
QRect textRect = opt.rect;
|
QRect textRect = opt.rect;
|
||||||
|
textRect.setWidth(qMin(textRect.width(), iconbox.width()));
|
||||||
QRect textHighlightRect = textRect;
|
QRect textHighlightRect = textRect;
|
||||||
// clip the decoration on top, remove width padding
|
// clip the decoration on top, remove width padding
|
||||||
textRect.adjust(textMargin, iconSize + textMargin + 5, -textMargin, 0);
|
textRect.adjust(textMargin, iconSize + textMargin + 5, -textMargin, 0);
|
||||||
@ -299,7 +300,7 @@ void ListViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
|
|||||||
const int lineCount = textLayout.lineCount();
|
const int lineCount = textLayout.lineCount();
|
||||||
|
|
||||||
const QRect layoutRect = QStyle::alignedRect(
|
const QRect layoutRect = QStyle::alignedRect(
|
||||||
opt.direction, opt.displayAlignment, QSize(textRect.width(), int(height)), textRect);
|
opt.direction, opt.displayAlignment, QSize(textRect.width(), int(height)), textRect);
|
||||||
const QPointF position = layoutRect.topLeft();
|
const QPointF position = layoutRect.topLeft();
|
||||||
for (int i = 0; i < lineCount; ++i)
|
for (int i = 0; i < lineCount; ++i)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user