Author: mir3x Date: Mon Sep 22 09:50:08 2014 New Revision: 26523 URL: http://svn.gna.org/viewcvs/freeciv?rev=26523&view=rev Log: Removed white spaces in city dialog on progress bar, and added better resizing for production widget.
See patch #5254 Modified: branches/S2_5/client/gui-qt/citydlg.cpp Modified: branches/S2_5/client/gui-qt/citydlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/citydlg.cpp?rev=26523&r1=26522&r2=26523&view=diff ============================================================================== --- branches/S2_5/client/gui-qt/citydlg.cpp (original) +++ branches/S2_5/client/gui-qt/citydlg.cpp Mon Sep 22 09:50:08 2014 @@ -1009,7 +1009,7 @@ for (int i = 0; i < str_list.count(); i++) { some_label = new QLabel(str_list.at(i)); slider_grid->addWidget(some_label, i + 1, 0, 1, 1); - some_label = new QLabel("0", this); + some_label = new QLabel("0"); some_label->setMinimumWidth(25); if (i != str_list.count() - 1) { slider = new QSlider(Qt::Horizontal); @@ -2045,6 +2045,7 @@ { char buf[32]; QPixmap *pix; + QString str; struct sprite *sprite; int cost = city_production_build_shield_cost(pcity); @@ -2060,13 +2061,15 @@ } production_combo->setAlignment(Qt::AlignCenter); production_combo_p->setAlignment(Qt::AlignCenter); - production_combo->setFormat(QString("(%p%) %2\n%1") + str = QString(buf); + str = str.simplified(); + production_combo->setFormat(QString("(%p%) %1\n%2") .arg(city_production_name_translation(pcity), - QString(buf))); + str)); production_combo_p->setFormat(QString("(%p%) %2\n%1") .arg(city_production_name_translation(pcity), - QString(buf))); + str)); if (VUT_UTYPE == pcity->production.kind) { sprite = get_unittype_sprite(tileset, pcity->production.value.utype, @@ -2554,10 +2557,10 @@ pixmap_put_x(&pix_scaled); } } - opt = QItemDelegate::setOptions(index, option); painter->save(); opt.displayAlignment = Qt::AlignLeft; + opt.textElideMode = Qt::ElideMiddle; QItemDelegate::drawBackground(painter, opt, index); rect1 = option.rect; rect1.setWidth(pix_scaled.width() + 4); @@ -2739,7 +2742,8 @@ renegade = NULL; pi = new production_item(renegade, this); city_target_list << pi; - sh.setX(sh.y() + sh.x()); + sh.setX(2 * sh.y() + sh.x()); + sh.setX(qMin(sh.x(), 250)); } /**************************************************************************** @@ -2823,6 +2827,9 @@ QAbstractItemView::mousePressEvent(event); } +/**************************************************************************** + Event filter for production widget +****************************************************************************/ bool production_widget::eventFilter(QObject *obj, QEvent *ev) { QRect pw_rect; _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits