| 42 | #define FILEATTACH_ICONSIZE 48 |
| 43 | |
| 44 | PixmapPreviewSelector::PixmapPreviewSelector(QWidget *parent, PreviewPosition position) |
| 45 | : QWidget(parent) |
| 46 | , m_previewPosition(position) |
| 47 | { |
| 48 | QVBoxLayout *mainlay = new QVBoxLayout(this); |
| 49 | mainlay->setContentsMargins(0, 0, 0, 0); |
| 50 | QHBoxLayout *toplay = new QHBoxLayout; |
| 51 | toplay->setContentsMargins(0, 0, 0, 0); |
| 52 | mainlay->addLayout(toplay); |
| 53 | m_comboItems = new KComboBox(this); |
| 54 | toplay->addWidget(m_comboItems); |
| 55 | m_stampPushButton = new QPushButton(QIcon::fromTheme(QStringLiteral("document-open")), QString(), this); |
| 56 | m_stampPushButton->setVisible(false); |
| 57 | m_stampPushButton->setToolTip(i18nc("@info:tooltip", "Select a custom stamp symbol from file")); |
| 58 | toplay->addWidget(m_stampPushButton); |
| 59 | m_iconLabel = new QLabel(this); |
| 60 | switch (m_previewPosition) { |
| 61 | case Side: |
| 62 | toplay->addWidget(m_iconLabel); |
| 63 | break; |
| 64 | case Below: |
| 65 | mainlay->addWidget(m_iconLabel); |
| 66 | mainlay->setAlignment(m_iconLabel, Qt::AlignHCenter); |
| 67 | break; |
| 68 | } |
| 69 | m_iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
| 70 | m_iconLabel->setAlignment(Qt::AlignCenter); |
| 71 | m_iconLabel->setFrameStyle(QFrame::StyledPanel); |
| 72 | setPreviewSize(32); |
| 73 | |
| 74 | setFocusPolicy(Qt::TabFocus); |
| 75 | setFocusProxy(m_comboItems); |
| 76 | |
| 77 | connect(m_comboItems, &QComboBox::currentIndexChanged, this, [this](int index) { iconComboChanged(m_comboItems->itemText(index)); }); |
| 78 | connect(m_comboItems, &QComboBox::editTextChanged, this, &PixmapPreviewSelector::iconComboChanged); |
| 79 | connect(m_stampPushButton, &QPushButton::clicked, this, &PixmapPreviewSelector::selectCustomStamp); |
| 80 | } |
| 81 | |
| 82 | PixmapPreviewSelector::~PixmapPreviewSelector() |
| 83 | { |
nothing calls this directly
no test coverage detected