Mercurial > projects > qtd
comparison demos/browser/urllineedit.d @ 73:7bfd46c330dc
more porting
author | mandel |
---|---|
date | Fri, 22 May 2009 10:59:00 +0000 |
parents | 71b382c10ef6 |
children | 37caa90ce503 |
comparison
equal
deleted
inserted
replaced
72:b149ef2cb18b | 73:7bfd46c330dc |
---|---|
39 ** | 39 ** |
40 ****************************************************************************/ | 40 ****************************************************************************/ |
41 | 41 |
42 module urllineedit; | 42 module urllineedit; |
43 | 43 |
44 import QtCore.QUrl; | 44 import qt.core.QUrl; |
45 import QtGui.QWidget; | 45 import qt.core.QEvent; |
46 import QtGui.QStyleOptionFrame; | 46 import qt.core.QDebug; |
47 | |
48 import qt.gui.QWidget; | |
49 import qt.gui.QStyleOptionFrame; | |
50 import qt.gui.QApplication; | |
51 import qt.gui.QCompleter; | |
52 import qt.gui.QFocusEvent; | |
53 import qt.gui.QHBoxLayout; | |
54 import qt.gui.QLabel; | |
55 import qt.gui.QLineEdit; | |
56 import qt.gui.QPainter; | |
57 import qt.gui.QStyle; | |
58 import qt.gui.QStyleOptionFrameV2; | |
47 | 59 |
48 import browserapplication; | 60 import browserapplication; |
49 import searchlineedit; | 61 import searchlineedit; |
50 import webview; | 62 import webview; |
51 | 63 |
52 import QtCore.QEvent; | 64 |
53 | |
54 import QtGui.QApplication; | |
55 import QtGui.QCompleter; | |
56 import QtGui.QFocusEvent; | |
57 import QtGui.QHBoxLayout; | |
58 import QtGui.QLabel; | |
59 import QtGui.QLineEdit; | |
60 import QtGui.QPainter; | |
61 import QtGui.QStyle; | |
62 import QtGui.QStyleOptionFrameV2; | |
63 | |
64 import QtCore.QDebug; | |
65 | |
66 | |
67 /* | |
68 QT_BEGIN_NAMESPACE | |
69 class QLineEdit; | |
70 QT_END_NAMESPACE | |
71 | |
72 class ClearButton; | |
73 */ | |
74 class ExLineEdit : public QWidget | 65 class ExLineEdit : public QWidget |
75 { | 66 { |
76 Q_OBJECT | |
77 | |
78 public: | 67 public: |
79 this(QWidget *parent = null) | 68 |
80 { | 69 this(QWidget parent = null) |
81 super(parent); | 70 { |
71 super(parent); | |
72 | |
73 m_leftWidget = 0; | |
74 m_lineEdit = new QLineEdit(this); | |
75 m_clearButton = 0; | |
76 | |
77 setFocusPolicy(m_lineEdit.focusPolicy()); | |
78 setAttribute(Qt.WA_InputMethodEnabled); | |
79 setSizePolicy(m_lineEdit.sizePolicy()); | |
80 setBackgroundRole(m_lineEdit.backgroundRole()); | |
81 setMouseTracking(true); | |
82 setAcceptDrops(true); | |
83 setAttribute(Qt.WA_MacShowFocusRect, true); | |
84 QPalette p = m_lineEdit.palette(); | |
85 setPalette(p); | |
86 | |
87 // line edit | |
88 m_lineEdit.setFrame(false); | |
89 m_lineEdit.setFocusProxy(this); | |
90 m_lineEdit.setAttribute(Qt.WA_MacShowFocusRect, false); | |
91 QPalette clearPalette = m_lineEdit.palette(); | |
92 clearPalette.setBrush(QPalette.Base, QBrush(Qt.transparent)); | |
93 m_lineEdit.setPalette(clearPalette); | |
94 | |
95 // clearButton | |
96 m_clearButton = new ClearButton(this); | |
97 m_clearButton.clicked.connect(&m_lineEdit.clear); | |
98 m_lineEdit.textChanged.connect(&m_clearButton.textChanged); | |
99 } | |
100 | |
101 QLineEdit lineEdit() { return m_lineEdit; } | |
102 | |
103 void setLeftWidget(QWidget widget) | |
104 { | |
105 m_leftWidget = widget; | |
106 } | |
107 | |
108 QWidget leftWidget() | |
109 { | |
110 return m_leftWidget; | |
111 } | |
112 | |
113 QSize sizeHint() | |
114 { | |
115 m_lineEdit.setFrame(true); | |
116 QSize size = m_lineEdit.sizeHint(); | |
117 m_lineEdit.setFrame(false); | |
118 return size; | |
119 } | |
120 | |
121 QVariant inputMethodQuery(Qt.InputMethodQuery property) | |
122 { | |
123 return m_lineEdit.inputMethodQuery(property); | |
124 } | |
125 | |
126 protected: | |
127 | |
128 void focusInEvent(QFocusEvent event) | |
129 { | |
130 m_lineEdit.event(event); | |
131 QWidget.focusInEvent(event); | |
132 } | |
133 | |
134 void focusOutEvent(QFocusEvent event) | |
135 { | |
136 m_lineEdit.event(event); | |
137 | |
138 if (m_lineEdit.completer()) { | |
139 m_lineEdit.completer().activated.connect(& m_lineEdit.setText); | |
140 m_lineEdit.completer().highlighted.connect(&m_lineEdit._q_completionHighlighted); | |
141 } | |
142 QWidget.focusOutEvent(event); | |
143 } | |
144 | |
145 void keyPressEvent(QKeyEvent event) | |
146 { | |
147 m_lineEdit.event(event); | |
148 } | |
149 | |
150 void paintEvent(QPaintEvent event) | |
151 { | |
152 QPainter p(this); | |
153 QStyleOptionFrameV2 panel; | |
154 initStyleOption(&panel); | |
155 style().drawPrimitive(QStyle.PE_PanelLineEdit, &panel, &p, this); | |
156 } | |
157 | |
158 void resizeEvent(QResizeEvent event) | |
159 { | |
160 assert(m_leftWidget); | |
161 updateGeometries(); | |
162 QWidget.resizeEvent(event); | |
163 } | |
164 | |
165 void inputMethodEvent(QInputMethodEvent e) | |
166 { | |
167 m_lineEdit.event(e); | |
168 } | |
169 | |
170 bool event(QEvent event) | |
171 { | |
172 if (event.type() == QEvent.ShortcutOverride) | |
173 return m_lineEdit.event(event); | |
174 return QWidget.event(event); | |
175 } | |
176 | |
177 protected: | |
178 | |
179 void updateGeometries() | |
180 { | |
181 QStyleOptionFrameV2 panel; | |
182 initStyleOption(&panel); | |
183 QRect rect = style().subElementRect(QStyle.SE_LineEditContents, &panel, this); | |
184 | |
185 int height = rect.height(); | |
186 int width = rect.width(); | |
187 | |
188 int m_leftWidgetHeight = m_leftWidget.height(); | |
189 m_leftWidget.setGeometry(rect.x() + 2, rect.y() + (height - m_leftWidgetHeight)/2, | |
190 m_leftWidget.width(), m_leftWidget.height()); | |
191 | |
192 int clearButtonWidth = this.height(); | |
193 m_lineEdit.setGeometry(m_leftWidget.x() + m_leftWidget.width(), 0, | |
194 width - clearButtonWidth - m_leftWidget.width(), this.height()); | |
195 | |
196 m_clearButton.setGeometry(this.width() - clearButtonWidth, 0, | |
197 clearButtonWidth, this.height()); | |
198 } | |
199 | |
200 void initStyleOption(QStyleOptionFrameV2 option) | |
201 { | |
202 option.initFrom(this); | |
203 option.rect = contentsRect(); | |
204 option.lineWidth = style().pixelMetric(QStyle.PM_DefaultFrameWidth, option, this); | |
205 option.midLineWidth = 0; | |
206 option.state |= QStyle.State_Sunken; | |
207 if (m_lineEdit.isReadOnly()) | |
208 option.state |= QStyle.State_ReadOnly; | |
209 version(QT_KEYPAD_NAVIGATION) | |
210 { | |
211 if (hasEditFocus()) | |
212 option.state |= QStyle.State_HasEditFocus; | |
213 } | |
214 else | |
215 { | |
216 option.features = QStyleOptionFrameV2.None; | |
217 } | |
218 } | |
82 | 219 |
83 m_leftWidget = 0; | 220 QWidget m_leftWidget; |
84 m_lineEdit = new QLineEdit(this); | 221 QLineEdit m_lineEdit; |
85 m_clearButton = 0; | 222 ClearButton m_clearButton; |
86 | |
87 setFocusPolicy(m_lineEdit.focusPolicy()); | |
88 setAttribute(Qt.WA_InputMethodEnabled); | |
89 setSizePolicy(m_lineEdit.sizePolicy()); | |
90 setBackgroundRole(m_lineEdit.backgroundRole()); | |
91 setMouseTracking(true); | |
92 setAcceptDrops(true); | |
93 setAttribute(Qt.WA_MacShowFocusRect, true); | |
94 QPalette p = m_lineEdit.palette(); | |
95 setPalette(p); | |
96 | |
97 // line edit | |
98 m_lineEdit.setFrame(false); | |
99 m_lineEdit.setFocusProxy(this); | |
100 m_lineEdit.setAttribute(Qt.WA_MacShowFocusRect, false); | |
101 QPalette clearPalette = m_lineEdit.palette(); | |
102 clearPalette.setBrush(QPalette::Base, QBrush(Qt.transparent)); | |
103 m_lineEdit.setPalette(clearPalette); | |
104 | |
105 // clearButton | |
106 m_clearButton = new ClearButton(this); | |
107 connect(m_clearButton, SIGNAL(clicked()), | |
108 m_lineEdit, SLOT(clear())); | |
109 connect(m_lineEdit, SIGNAL(textChanged(const QString&)), | |
110 m_clearButton, SLOT(textChanged(const QString&))); | |
111 } | 223 } |
112 | 224 |
113 inline QLineEdit *lineEdit() { return m_lineEdit; } | |
114 | |
115 void setLeftWidget(QWidget *widget) | |
116 { | |
117 m_leftWidget = widget; | |
118 } | |
119 | |
120 QWidget *leftWidget() | |
121 { | |
122 return m_leftWidget; | |
123 } | |
124 | |
125 QSize sizeHint() | |
126 { | |
127 m_lineEdit.setFrame(true); | |
128 QSize size = m_lineEdit.sizeHint(); | |
129 m_lineEdit.setFrame(false); | |
130 return size; | |
131 } | |
132 | |
133 QVariant inputMethodQuery(Qt.InputMethodQuery property) | |
134 { | |
135 return m_lineEdit.inputMethodQuery(property); | |
136 } | |
137 | |
138 protected: | |
139 void focusInEvent(QFocusEvent *event) | |
140 { | |
141 m_lineEdit.event(event); | |
142 QWidget::focusInEvent(event); | |
143 } | |
144 | |
145 void focusOutEvent(QFocusEvent *event) | |
146 { | |
147 m_lineEdit.event(event); | |
148 | |
149 if (m_lineEdit.completer()) { | |
150 connect(m_lineEdit.completer(), SIGNAL(activated(QString)), | |
151 m_lineEdit, SLOT(setText(QString))); | |
152 connect(m_lineEdit.completer(), SIGNAL(highlighted(QString)), | |
153 m_lineEdit, SLOT(_q_completionHighlighted(QString))); | |
154 } | |
155 QWidget::focusOutEvent(event); | |
156 } | |
157 | |
158 void keyPressEvent(QKeyEvent *event) | |
159 { | |
160 m_lineEdit.event(event); | |
161 } | |
162 | |
163 void paintEvent(QPaintEvent *event) | |
164 { | |
165 QPainter p(this); | |
166 QStyleOptionFrameV2 panel; | |
167 initStyleOption(&panel); | |
168 style().drawPrimitive(QStyle::PE_PanelLineEdit, &panel, &p, this); | |
169 } | |
170 | |
171 void resizeEvent(QResizeEvent *event) | |
172 { | |
173 Q_ASSERT(m_leftWidget); | |
174 updateGeometries(); | |
175 QWidget::resizeEvent(event); | |
176 } | |
177 | |
178 void inputMethodEvent(QInputMethodEvent *e) | |
179 { | |
180 m_lineEdit.event(e); | |
181 } | |
182 | |
183 bool event(QEvent *event) | |
184 { | |
185 if (event.type() == QEvent::ShortcutOverride) | |
186 return m_lineEdit.event(event); | |
187 return QWidget::event(event); | |
188 } | |
189 | |
190 protected: | |
191 void updateGeometries() | |
192 { | |
193 QStyleOptionFrameV2 panel; | |
194 initStyleOption(&panel); | |
195 QRect rect = style().subElementRect(QStyle::SE_LineEditContents, &panel, this); | |
196 | |
197 int height = rect.height(); | |
198 int width = rect.width(); | |
199 | |
200 int m_leftWidgetHeight = m_leftWidget.height(); | |
201 m_leftWidget.setGeometry(rect.x() + 2, rect.y() + (height - m_leftWidgetHeight)/2, | |
202 m_leftWidget.width(), m_leftWidget.height()); | |
203 | |
204 int clearButtonWidth = this.height(); | |
205 m_lineEdit.setGeometry(m_leftWidget.x() + m_leftWidget.width(), 0, | |
206 width - clearButtonWidth - m_leftWidget.width(), this.height()); | |
207 | |
208 m_clearButton.setGeometry(this.width() - clearButtonWidth, 0, | |
209 clearButtonWidth, this.height()); | |
210 } | |
211 | |
212 void initStyleOption(QStyleOptionFrameV2 *option) | |
213 { | |
214 option.initFrom(this); | |
215 option.rect = contentsRect(); | |
216 option.lineWidth = style().pixelMetric(QStyle::PM_DefaultFrameWidth, option, this); | |
217 option.midLineWidth = 0; | |
218 option.state |= QStyle::State_Sunken; | |
219 if (m_lineEdit.isReadOnly()) | |
220 option.state |= QStyle::State_ReadOnly; | |
221 version(QT_KEYPAD_NAVIGATION) | |
222 if (hasEditFocus()) | |
223 option.state |= QStyle::State_HasEditFocus; | |
224 } | |
225 option.features = QStyleOptionFrameV2::None; | |
226 } | |
227 | |
228 QWidget *m_leftWidget; | |
229 QLineEdit *m_lineEdit; | |
230 ClearButton *m_clearButton; | |
231 }; | |
232 | 225 |
233 class UrlIconLabel : public QLabel | 226 class UrlIconLabel : public QLabel |
234 { | 227 { |
235 | |
236 public: | 228 public: |
237 this(QWidget *parent) | 229 |
238 { | 230 this(QWidget parent) |
239 super(parent); | 231 { |
240 m_webView = 0; | 232 super(parent); |
241 setMinimumWidth(16); | 233 m_webView = 0; |
242 setMinimumHeight(16); | 234 setMinimumWidth(16); |
235 setMinimumHeight(16); | |
236 } | |
237 | |
238 WebView m_webView; | |
239 | |
240 protected: | |
241 | |
242 void mousePressEvent(QMouseEvent event) | |
243 { | |
244 if (event.button() == Qt.LeftButton) | |
245 m_dragStartPos = event.pos(); | |
246 QLabel.mousePressEvent(event); | |
247 } | |
248 | |
249 void mouseMoveEvent(QMouseEvent event) | |
250 { | |
251 if (event.buttons() == Qt.LeftButton | |
252 && (event.pos() - m_dragStartPos).manhattanLength() > QApplication.startDragDistance() | |
253 && m_webView) { | |
254 QDrag drag = new QDrag(this); | |
255 QMimeData mimeData = new QMimeData; | |
256 mimeData.setText(QString.fromUtf8(m_webView.url().toEncoded())); | |
257 QList<QUrl> urls; | |
258 urls.append(m_webView.url()); | |
259 mimeData.setUrls(urls); | |
260 drag.setMimeData(mimeData); | |
261 drag.exec(); | |
262 } | |
263 } | |
264 | |
265 private: | |
266 | |
267 QPoint m_dragStartPos; | |
243 } | 268 } |
244 | 269 |
245 | 270 |
246 WebView *m_webView; | |
247 | |
248 protected: | |
249 void mousePressEvent(QMouseEvent *event) | |
250 { | |
251 if (event.button() == Qt.LeftButton) | |
252 m_dragStartPos = event.pos(); | |
253 QLabel::mousePressEvent(event); | |
254 } | |
255 | |
256 void mouseMoveEvent(QMouseEvent *event) | |
257 { | |
258 if (event.buttons() == Qt.LeftButton | |
259 && (event.pos() - m_dragStartPos).manhattanLength() > QApplication::startDragDistance() | |
260 && m_webView) { | |
261 QDrag *drag = new QDrag(this); | |
262 QMimeData *mimeData = new QMimeData; | |
263 mimeData.setText(QString::fromUtf8(m_webView.url().toEncoded())); | |
264 QList<QUrl> urls; | |
265 urls.append(m_webView.url()); | |
266 mimeData.setUrls(urls); | |
267 drag.setMimeData(mimeData); | |
268 drag.exec(); | |
269 } | |
270 } | |
271 | |
272 private: | |
273 QPoint m_dragStartPos; | |
274 | |
275 } | |
276 | |
277 | |
278 //class UrlIconLabel; | |
279 //class WebView; | |
280 class UrlLineEdit : public ExLineEdit | 271 class UrlLineEdit : public ExLineEdit |
281 { | 272 { |
282 Q_OBJECT | |
283 | |
284 public: | 273 public: |
285 this(QWidget *parent = null) | 274 |
286 { | 275 this(QWidget parent = null) |
287 super(parent); | 276 { |
288 m_webView = 0; | 277 super(parent); |
289 m_iconLabel = 0; | 278 m_webView = 0; |
290 // icon | 279 m_iconLabel = 0; |
291 m_iconLabel = new UrlIconLabel(this); | 280 // icon |
292 m_iconLabel.resize(16, 16); | 281 m_iconLabel = new UrlIconLabel(this); |
293 setLeftWidget(m_iconLabel); | 282 m_iconLabel.resize(16, 16); |
294 m_defaultBaseColor = palette().color(QPalette::Base); | 283 setLeftWidget(m_iconLabel); |
295 | 284 m_defaultBaseColor = palette().color(QPalette.Base); |
296 webViewIconChanged(); | 285 |
286 webViewIconChanged(); | |
287 } | |
288 | |
289 void setWebView(WebView webView) | |
290 { | |
291 assert(!m_webView); | |
292 m_webView = webView; | |
293 m_iconLabel.m_webView = webView; | |
294 webView.urlChanged.connect(&this.webViewUrlChanged); | |
295 webView.loadFinished.connect(&this.webViewIconChanged); | |
296 webView.iconChanged.connect(&this.webViewIconChanged); | |
297 webView.loadProgress.connect(&this.update); | |
298 } | |
299 | |
300 protected: | |
301 | |
302 void paintEvent(QPaintEvent event) | |
303 { | |
304 QPalette p = palette(); | |
305 if (m_webView && m_webView.url().scheme() == QLatin1String("https")) { | |
306 QColor lightYellow(248, 248, 210); | |
307 p.setBrush(QPalette.Base, generateGradient(lightYellow)); | |
308 } else { | |
309 p.setBrush(QPalette.Base, m_defaultBaseColor); | |
310 } | |
311 setPalette(p); | |
312 ExLineEdit.paintEvent(event); | |
313 | |
314 QPainter painter(this); | |
315 QStyleOptionFrameV2 panel; | |
316 initStyleOption(&panel); | |
317 QRect backgroundRect = style().subElementRect(QStyle.SE_LineEditContents, &panel, this); | |
318 if (m_webView && !hasFocus()) { | |
319 int progress = m_webView.progress(); | |
320 QColor loadingColor = QColor(116, 192, 250); | |
321 painter.setBrush(generateGradient(loadingColor)); | |
322 painter.setPen(Qt.transparent); | |
323 int mid = backgroundRect.width() / 100 * progress; | |
324 QRect progressRect(backgroundRect.x(), backgroundRect.y(), mid, backgroundRect.height()); | |
325 painter.drawRect(progressRect); | |
326 } | |
327 } | |
328 | |
329 void focusOutEvent(QFocusEvent event); | |
330 { | |
331 if (m_lineEdit.text().isEmpty() && m_webView) | |
332 m_lineEdit.setText(QString.fromUtf8(m_webView.url().toEncoded())); | |
333 ExLineEdit.focusOutEvent(event); | |
334 } | |
335 | |
336 private: | |
337 | |
338 void webViewUrlChanged(QUrl url) | |
339 { | |
340 m_lineEdit.setText(QString.fromUtf8(url.toEncoded())); | |
341 m_lineEdit.setCursorPosition(0); | |
342 } | |
343 | |
344 void webViewIconChanged() | |
345 { | |
346 QUrl url = (m_webView) ? m_webView.url() : QUrl(); | |
347 QIcon icon = BrowserApplication.instance().icon(url); | |
348 QPixmap pixmap(icon.pixmap(16, 16)); | |
349 m_iconLabel.setPixmap(pixmap); | |
350 } | |
351 | |
352 private: | |
353 | |
354 QLinearGradient generateGradient(QColor color) | |
355 { | |
356 QLinearGradient gradient(0, 0, 0, height()); | |
357 gradient.setColorAt(0, m_defaultBaseColor); | |
358 gradient.setColorAt(0.15, color.lighter(120)); | |
359 gradient.setColorAt(0.5, color); | |
360 gradient.setColorAt(0.85, color.lighter(120)); | |
361 gradient.setColorAt(1, m_defaultBaseColor); | |
362 return gradient; | |
363 } | |
364 | |
365 WebView m_webView; | |
366 UrlIconLabel m_iconLabel; | |
367 QColor m_defaultBaseColor; | |
297 } | 368 } |
298 void setWebView(WebView *webView) | |
299 { | |
300 Q_ASSERT(!m_webView); | |
301 m_webView = webView; | |
302 m_iconLabel.m_webView = webView; | |
303 connect(webView, SIGNAL(urlChanged(const QUrl &)), | |
304 this, SLOT(webViewUrlChanged(const QUrl &))); | |
305 connect(webView, SIGNAL(loadFinished(bool)), | |
306 this, SLOT(webViewIconChanged())); | |
307 connect(webView, SIGNAL(iconChanged()), | |
308 this, SLOT(webViewIconChanged())); | |
309 connect(webView, SIGNAL(loadProgress(int)), | |
310 this, SLOT(update())); | |
311 } | |
312 | |
313 protected: | |
314 void paintEvent(QPaintEvent *event) | |
315 { | |
316 QPalette p = palette(); | |
317 if (m_webView && m_webView.url().scheme() == QLatin1String("https")) { | |
318 QColor lightYellow(248, 248, 210); | |
319 p.setBrush(QPalette::Base, generateGradient(lightYellow)); | |
320 } else { | |
321 p.setBrush(QPalette::Base, m_defaultBaseColor); | |
322 } | |
323 setPalette(p); | |
324 ExLineEdit::paintEvent(event); | |
325 | |
326 QPainter painter(this); | |
327 QStyleOptionFrameV2 panel; | |
328 initStyleOption(&panel); | |
329 QRect backgroundRect = style().subElementRect(QStyle::SE_LineEditContents, &panel, this); | |
330 if (m_webView && !hasFocus()) { | |
331 int progress = m_webView.progress(); | |
332 QColor loadingColor = QColor(116, 192, 250); | |
333 painter.setBrush(generateGradient(loadingColor)); | |
334 painter.setPen(Qt.transparent); | |
335 int mid = backgroundRect.width() / 100 * progress; | |
336 QRect progressRect(backgroundRect.x(), backgroundRect.y(), mid, backgroundRect.height()); | |
337 painter.drawRect(progressRect); | |
338 } | |
339 } | |
340 | |
341 void focusOutEvent(QFocusEvent *event); | |
342 { | |
343 if (m_lineEdit.text().isEmpty() && m_webView) | |
344 m_lineEdit.setText(QString::fromUtf8(m_webView.url().toEncoded())); | |
345 ExLineEdit::focusOutEvent(event); | |
346 } | |
347 | |
348 private slots: | |
349 void webViewUrlChanged(const QUrl &url) | |
350 { | |
351 m_lineEdit.setText(QString::fromUtf8(url.toEncoded())); | |
352 m_lineEdit.setCursorPosition(0); | |
353 } | |
354 | |
355 void webViewIconChanged() | |
356 { | |
357 QUrl url = (m_webView) ? m_webView.url() : QUrl(); | |
358 QIcon icon = BrowserApplication::instance().icon(url); | |
359 QPixmap pixmap(icon.pixmap(16, 16)); | |
360 m_iconLabel.setPixmap(pixmap); | |
361 } | |
362 | |
363 private: | |
364 QLinearGradient generateGradient(const QColor &color) | |
365 { | |
366 QLinearGradient gradient(0, 0, 0, height()); | |
367 gradient.setColorAt(0, m_defaultBaseColor); | |
368 gradient.setColorAt(0.15, color.lighter(120)); | |
369 gradient.setColorAt(0.5, color); | |
370 gradient.setColorAt(0.85, color.lighter(120)); | |
371 gradient.setColorAt(1, m_defaultBaseColor); | |
372 return gradient; | |
373 } | |
374 | |
375 WebView *m_webView; | |
376 UrlIconLabel *m_iconLabel; | |
377 QColor m_defaultBaseColor; | |
378 } |