Qt: Fix when build with Qt < 4.8.0

StyleName is not available in Qt < 4.8

Change-Id: Icbfcef7c62b124ce67f1a02ed928a96233ae2d9d
Reviewed-on: https://code.wireshark.org/review/3508
Reviewed-by: Christopher Maynard <Christopher.Maynard@gtech.com>
This commit is contained in:
Alexis La Goutte 2014-08-08 19:50:24 +02:00 committed by Christopher Maynard
parent 6379236e7e
commit 020d0f8963
2 changed files with 11 additions and 1 deletions

View File

@ -81,9 +81,15 @@ void FontColorPreferencesFrame::updateWidgets()
{
int margin = style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
#if QT_VERSION < QT_VERSION_CHECK(4, 8, 0)
ui->fontPushButton->setText(
cur_font_.family() + " "/* + cur_font_.styleName() + " "*/ +
cur_font_.family() + " " +
QString::number(cur_font_.pointSizeF(), 'f', 1));
#else
ui->fontPushButton->setText(
cur_font_.family() + " " + cur_font_.styleName() + " " +
QString::number(cur_font_.pointSizeF(), 'f', 1));
#endif
ui->fontSampleLineEdit->setFont(cur_font_);
QString line_edit_ss = QString("QLineEdit { margin-left: %1px; }").arg(margin);

View File

@ -55,7 +55,11 @@ QString gchar_free_to_qstring(gchar *glib_string) {
void smooth_font_size(QFont &font) {
QFontDatabase fdb;
#if QT_VERSION < QT_VERSION_CHECK(4, 8, 0)
QList<int> size_list = fdb.smoothSizes(font.family(), "");
#else
QList<int> size_list = fdb.smoothSizes(font.family(), font.styleName());
#endif
if (size_list.size() < 2) return;