【正文】
(0,80)。 建立了一個(gè) BlueTitleBar類對(duì) Dock的標(biāo)題欄進(jìn)行美化,定 義了一個(gè) void BlueTitleBar::paintEvent(QPaintEvent*)的方法去給標(biāo)題欄具體的添加圖片信息,通過(guò)一下兩條語(yǔ)句調(diào)用 BlueTitleBar類去美化左邊的 Dock 但是運(yùn)行結(jié)果沒(méi)有得到預(yù)想的結(jié)果,通過(guò)查詢 Qt手冊(cè)中QDockWidget類的 setTitleBar()方法的使用,發(fā)現(xiàn)使用這個(gè)方法必須要有可用的 QWidget::sizeHint() 和 QWidget::minimumSizeHint()方法,這兩個(gè)方法是用來(lái)確定窗口標(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é):通過(guò)前一周的學(xué)習(xí)建立了關(guān)于 Qt中的一些基礎(chǔ)性的概念,進(jìn)一步認(rèn)識(shí)了面向?qū)ο蟮木幊趟枷?