60 setContentsMargins(0, 0, 0, 0);
61 setScaledContents(
false);
62 setOpenExternalLinks(
true);
63 setTextFormat(Qt::RichText);
64 setFocusPolicy(Qt::NoFocus);
65 setTextInteractionFlags(Qt::LinksAccessibleByMouse);
66 setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
67 QImage img = QImage(imgPath);
257 QFontMetrics fm(fontMetrics());
258 QRect geom = geometry();
259 QPoint
p(geom.width() / 2 + geom.left(), geom.height() / 2 + geom.top());
260 QScreen *s = qApp->screenAt(
p);
263 maxW = s->availableGeometry().width() * 3 / 4;
268 int currentW = fm.horizontalAdvance(
d->ajdText);
270 return (QSize(currentW > maxW ? maxW : currentW, QLabel::sizeHint().height()));
401 if (
d->fdMode == QFileDialog::ExistingFiles)
403 qCDebug(LIBKDCRAW_LOG) <<
"Multiple selection is not supported";
407 QFileDialog*
const fileDlg =
new QFileDialog(
this);
408 fileDlg->setOptions(
d->fdOptions);
409 fileDlg->setDirectory(QFileInfo(
d->edit->text()).dir());
410 fileDlg->setFileMode(
d->fdMode);
412 if (!
d->fdFilter.isNull())
413 fileDlg->setNameFilter(
d->fdFilter);
415 if (!
d->fdTitle.isNull())
416 fileDlg->setWindowTitle(
d->fdTitle);
418 connect(fileDlg, SIGNAL(urlSelected(QUrl)),
423 if (fileDlg->exec() == QDialog::Accepted)
429 d->edit->setText(sel.first());
440 QPixmap pix(QStandardPaths::locate(QStandardPaths::AppDataLocation, QLatin1String(
"libkdcraw/pics/process-working.png")));
445 qCWarning(LIBKDCRAW_LOG) <<
"Invalid pixmap specified.";
451 size = QSize(pix.width(), pix.width());
454 if (pix.width() % size.width() || pix.height() % size.height())
456 qCWarning(LIBKDCRAW_LOG) <<
"Invalid framesize.";
460 const int rowCount = pix.height() / size.height();
461 const int colCount = pix.width() / size.width();
462 m_frames.resize(rowCount * colCount);
466 for (
int row = 0; row < rowCount; ++row)
468 for (
int col = 0; col < colCount; ++col)
470 QPixmap frm = pix.copy(col * size.width(), row * size.height(), size.width(), size.height());
565 QPainter painter(
this);
566 QStyle*
const style = QWidget::style();
568 QStyleOptionButton opt;
571 opt.state |= isDown() ? QStyle::State_Sunken : QStyle::State_Raised;
572 opt.features = QStyleOptionButton::None;
576 style->drawControl(QStyle::CE_PushButtonBevel, &opt, &painter,
this);
578 QRect labelRect = style->subElementRect(QStyle::SE_PushButtonContents, &opt,
this);
579 int shift = style->pixelMetric(QStyle::PM_ButtonMargin, &opt,
this) / 2;
580 labelRect.adjust(shift, shift, -shift, -shift);
582 labelRect.getRect(&x, &y, &w, &h);
584 if (isChecked() || isDown())
586 x += style->pixelMetric(QStyle::PM_ButtonShiftHorizontal, &opt,
this);
587 y += style->pixelMetric(QStyle::PM_ButtonShiftVertical, &opt,
this);
590 QColor fillCol = isEnabled() ?
d->color :
palette().color(backgroundRole());
591 qDrawShadePanel(&painter, x, y, w, h,
palette(),
true, 1, 0);
593 if (fillCol.isValid())
595 const QRect
rect(x + 1, y + 1, w - 2, h - 2);
597 if (fillCol.alpha() < 255)
599 QPixmap chessboardPattern(16, 16);
600 QPainter patternPainter(&chessboardPattern);
601 patternPainter.fillRect(0, 0, 8, 8, Qt::black);
602 patternPainter.fillRect(8, 8, 8, 8, Qt::black);
603 patternPainter.fillRect(0, 8, 8, 8, Qt::white);
604 patternPainter.fillRect(8, 0, 8, 8, Qt::white);
605 patternPainter.end();
606 painter.fillRect(
rect, QBrush(chessboardPattern));
609 painter.fillRect(
rect, fillCol);
614 QRect focusRect = style->subElementRect(QStyle::SE_PushButtonFocusRect, &opt,
this);
615 QStyleOptionFocusRect focusOpt;
616 focusOpt.initFrom(
this);
617 focusOpt.rect = focusRect;
618 focusOpt.backgroundColor =
palette().window().color();
619 style->drawPrimitive(QStyle::PE_FrameFocusRect, &focusOpt, &painter,
this);