http://blog.donews.com/Yolanda/archive/2005/01/12/236605.aspx
不知道这段话在说什么

#include QString locate("data",QString("amarok/images"));
可以返回amarok安装目录的绝对路径 /opt/kde3/share/apps/amarok/images
Qt QPalette QColorGroup
真是奇怪阿,Disabled状态竟然调的是QColorGroup::Text,让我猜了好久。
Qt setPaletteBackgroundPixmap();
可以使窗体擦除时无闪动重载
QPushButton::drawButton(QPainter *p);
QPushButton::paintEvent(QPainEvent *event);
可以加速画button的速度例如:
void CSkinButton::paintEvent(QPaintEvent * e)
 //It is this function that make the repaint very quick,why??? I don’t know very well.
{
 if(toggleType() == QButton::Toggle)
 {
  //QSharedDoubleBuffer buffer( this );
  drawButton( & QPainter(this) );
  //This is very important , maybe it make the area small
 }
}

void CSkinButton::drawButton(QPainter * painter)
{
 if(isEnabled())
 {
  if(toggleType() == QButton::SingleShot)
  {
   painter->drawPixmap(0,0,*m_item->m_normalImage);
  }
   else if(toggleType() == QButton::Toggle)
   {
    if(state() == QButton::On)
    {
     //setPaletteBackgroundPixmap(*m_item->m_activeImage);
     painter->drawPixmap(0,0,*m_item->m_activeImage);
    }
    else
    {
     //setPaletteBackgroundPixmap(*m_item->m_normalImage);
     painter->drawPixmap(0,0,*m_item->m_normalImage);
    }
   }
 }
  else
  {
   painter->drawPixmap(0,0,*m_item->m_disabledImage);
  }
}
      
 用小图来填充大图
 QPixmap mLabPix2("/root/mywork/qtapps/test/images/label2.png");
 QPixmap mLabBigPix(1000,mFancyLab->height());
 int i;
 int widthBig = 1000;
 //width()-mFancyLab->width();
 int widthSml = mLabPix2.width();
 for(i = 0 ; i < widthBig; i+=widthSml)
 {
  copyBlt(&mLabBigPix, i, 0, &mLabPix2, 0, 0,widthSml, mFancyLab->height() );
 }
 if(mLabPix2.isNull())
 {
  qWarning("Can’t find the pixmap for fancy label");
 }
 else
 {
  mExtLab->setPixmap(mLabBigPix);
 }
   
     QMainWindow::addDockWindow ( QDockWindow * dockWindow, Dock edge = DockTop, bool newLine = FALSE ) ;
     添加布局,组件在QMainWiddow


评论

该日志第一篇评论

发表评论

评论也有版权!