【正文】
(0,80)。 建立了一個 BlueTitleBar類對 Dock的標(biāo)題欄進(jìn)行美化,定 義了一個 void BlueTitleBar::paintEvent(QPaintEvent*)的方法去給標(biāo)題欄具體的添加圖片信息,通過一下兩條語句調(diào)用 BlueTitleBar類去美化左邊的 Dock 但是運(yùn)行結(jié)果沒有得到預(yù)想的結(jié)果,通過查詢 Qt手冊中QDockWidget類的 setTitleBar()方法的使用,發(fā)現(xiàn)使用這個方法必須要有可用的 QWidget::sizeHint() 和 QWidget::minimumSizeHint()方法,這兩個方法是用來確定窗口標(biāo)題欄現(xiàn)在的方向信息,以便進(jìn)行美化添加 titlebar = new BlueTitleBar(m_pLeftDock)。 m_pLeftDocksetTitleBarWidget(titlebar)。 Void QDockWidget::setTitleBarWidget( QWidget *widget) Sets an arbitrary widget as the dock widget39。s title bar. If widget is 0, any custom title bar widget previously set on the dock widget is removed, but not deleted, and the default title bar will be used instead. Tip: The title bar widget must have a valid QWidget::sizeHint() and QWidget::minimumSizeHint(). These functions should take into account the current orientation of the title bar. 總結(jié):通過前一周的學(xué)習(xí)建立了關(guān)于 Qt中的一些基礎(chǔ)性的概念,進(jìn)一步認(rèn)識了面向?qū)ο蟮木幊趟枷?