67 QBoxLayout *topLayOut;
69 if (flags & NarrowLayout) {
70 topLayOut =
new QVBoxLayout(
this);
71 layOut =
new QHBoxLayout;
72 topLayOut->addLayout(layOut);
74 topLayOut = layOut =
new QHBoxLayout(
this);
77 topLayOut->setSpacing(6);
78 topLayOut->setContentsMargins(QMargins());
81 m_toolClose =
new QToolButton(
this);
82 m_toolClose->setIcon(afwCreateIconSet(
"closetab.png"_L1));
83 m_toolClose->setAutoRaise(
true);
84 layOut->addWidget(m_toolClose);
85 connect(m_toolClose, &QAbstractButton::clicked,
this, &AbstractFindWidget::deactivate);
87 m_editFind =
new QLineEdit(
this);
88 layOut->addWidget(m_editFind);
89 connect(m_editFind, &QLineEdit::returnPressed,
this, &AbstractFindWidget::findNext);
90 connect(m_editFind, &QLineEdit::textChanged,
this, &AbstractFindWidget::findCurrentText);
91 connect(m_editFind, &QLineEdit::textChanged,
this, &AbstractFindWidget::updateButtons);
93 m_toolPrevious =
new QToolButton(
this);
94 m_toolPrevious->setAutoRaise(
true);
95 m_toolPrevious->setText(tr(
"&Previous"));
96 m_toolPrevious->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
97 m_toolPrevious->setIcon(afwCreateIconSet(
"previous.png"_L1));
98 layOut->addWidget(m_toolPrevious);
99 connect(m_toolPrevious, &QAbstractButton::clicked,
this, &AbstractFindWidget::findPrevious);
101 m_toolNext =
new QToolButton(
this);
102 m_toolNext->setAutoRaise(
true);
103 m_toolNext->setText(tr(
"&Next"));
104 m_toolNext->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
105 m_toolNext->setIcon(afwCreateIconSet(
"next.png"_L1));
106 layOut->addWidget(m_toolNext);
107 connect(m_toolNext, &QAbstractButton::clicked,
this, &AbstractFindWidget::findNext);
109 if (flags & NarrowLayout) {
110 QSizePolicy sp(QSizePolicy::Preferred, QSizePolicy::Fixed);
111 m_toolPrevious->setSizePolicy(sp);
112 m_toolPrevious->setMinimumWidth(m_toolPrevious->minimumSizeHint().height());
113 m_toolNext->setSizePolicy(sp);
114 m_toolNext->setMinimumWidth(m_toolNext->minimumSizeHint().height());
116 QSpacerItem *spacerItem =
117 new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum);
118 layOut->addItem(spacerItem);
120 layOut =
new QHBoxLayout;
121 topLayOut->addLayout(layOut);
123 m_editFind->setMinimumWidth(150);
126 if (!(flags & NoCaseSensitive)) {
127 m_checkCase =
new QCheckBox(tr(
"&Case sensitive"),
this);
128 layOut->addWidget(m_checkCase);
129 connect(m_checkCase, &QAbstractButton::toggled,
130 this, &AbstractFindWidget::findCurrentText);
135 if (!(flags & NoWholeWords)) {
136 m_checkWholeWords =
new QCheckBox(tr(
"Whole &words"),
this);
137 layOut->addWidget(m_checkWholeWords);
138 connect(m_checkWholeWords, &QAbstractButton::toggled,
139 this, &AbstractFindWidget::findCurrentText);
141 m_checkWholeWords = 0;
144 m_labelWrapped =
new QLabel(
this);
145 m_labelWrapped->setTextFormat(Qt::RichText);
146 m_labelWrapped->setAlignment(
147 Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
148 m_labelWrapped->setText(
149 tr(
"<img src=\":/qt-project.org/shared/images/wrap.png\">"
150 " Search wrapped"));
151 m_labelWrapped->hide();
152 layOut->addWidget(m_labelWrapped);
154 QSpacerItem *spacerItem =
155 new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum);
156 layOut->addItem(spacerItem);
158 setMinimumWidth(minimumSizeHint().width());