当前位置: 首页>>代码示例>>C++>>正文


C++ QBitmap::toWinHBITMAP方法代码示例

本文整理汇总了C++中QBitmap::toWinHBITMAP方法的典型用法代码示例。如果您正苦于以下问题:C++ QBitmap::toWinHBITMAP方法的具体用法?C++ QBitmap::toWinHBITMAP怎么用?C++ QBitmap::toWinHBITMAP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QBitmap的用法示例。


在下文中一共展示了QBitmap::toWinHBITMAP方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QIcon

void MainWindow::W7ToolbarSetImages() {
    QPixmap img;
    QBitmap mask;
    HIMAGELIST himl = ImageList_Create(20, 20, ILC_COLOR32, 4, 0);

    img = QIcon(":/back.png").pixmap(20);
    mask  = img.createMaskFromColor(Qt::transparent);
    ImageList_Add(himl, img.toWinHBITMAP(QPixmap::PremultipliedAlpha), mask.toWinHBITMAP());

    img = QIcon(":/play.png").pixmap(20);
    mask  = img.createMaskFromColor(Qt::transparent);
    ImageList_Add(himl, img.toWinHBITMAP(QPixmap::PremultipliedAlpha), mask.toWinHBITMAP());

    img = QIcon(":/forward.png").pixmap(20);
    mask  = img.createMaskFromColor(Qt::transparent);
    ImageList_Add(himl, img.toWinHBITMAP(QPixmap::PremultipliedAlpha), mask.toWinHBITMAP());

    img = QIcon(":/pause.png").pixmap(20);
    mask  = img.createMaskFromColor(Qt::transparent);
    ImageList_Add(himl, img.toWinHBITMAP(QPixmap::PremultipliedAlpha), mask.toWinHBITMAP());

    if (m_w7toolbar) m_w7toolbar->ThumbBarSetImageList(this->winId(), himl);

    ImageList_Destroy(himl);
}
开发者ID:Vanyar53,项目名称:blogstuff,代码行数:25,代码来源:mainwindow.cpp

示例2: createTaskBarButtons

void MainInterface::createTaskBarButtons()
{
    taskbar_wmsg = WM_NULL;
    /*Here is the code for the taskbar thumb buttons
    FIXME:We need pretty buttons in 16x16 px that are handled correctly by masks in Qt
    FIXME:the play button's picture doesn't changed to pause when clicked
    */

    CoInitialize( 0 );

    if( S_OK == CoCreateInstance( CLSID_TaskbarList,
                NULL, CLSCTX_INPROC_SERVER,
                IID_ITaskbarList3,
                (void **)&p_taskbl) )
    {
        p_taskbl->HrInit();

        if( (himl = ImageList_Create( 20, //cx
                        20, //cy
                        ILC_COLOR32,//flags
                        4,//initial nb of images
                        0//nb of images that can be added
                        ) ) != NULL )
        {
            QPixmap img   = QPixmap(":/win7/prev");
            QPixmap img2  = QPixmap(":/win7/pause");
            QPixmap img3  = QPixmap(":/win7/play");
            QPixmap img4  = QPixmap(":/win7/next");
            QBitmap mask  = img.createMaskFromColor(Qt::transparent);
            QBitmap mask2 = img2.createMaskFromColor(Qt::transparent);
            QBitmap mask3 = img3.createMaskFromColor(Qt::transparent);
            QBitmap mask4 = img4.createMaskFromColor(Qt::transparent);

            if(-1 == ImageList_Add(himl, img.toWinHBITMAP(QPixmap::PremultipliedAlpha),mask.toWinHBITMAP()))
                msg_Err( p_intf, "First ImageList_Add failed" );
            if(-1 == ImageList_Add(himl, img2.toWinHBITMAP(QPixmap::PremultipliedAlpha),mask2.toWinHBITMAP()))
                msg_Err( p_intf, "Second ImageList_Add failed" );
            if(-1 == ImageList_Add(himl, img3.toWinHBITMAP(QPixmap::PremultipliedAlpha),mask3.toWinHBITMAP()))
                msg_Err( p_intf, "Third ImageList_Add failed" );
            if(-1 == ImageList_Add(himl, img4.toWinHBITMAP(QPixmap::PremultipliedAlpha),mask4.toWinHBITMAP()))
                msg_Err( p_intf, "Fourth ImageList_Add failed" );
        }

        // Define an array of two buttons. These buttons provide images through an
        // image list and also provide tooltips.
        THUMBBUTTONMASK dwMask = THUMBBUTTONMASK(THB_BITMAP | THB_FLAGS);

        THUMBBUTTON thbButtons[3];
        thbButtons[0].dwMask = dwMask;
        thbButtons[0].iId = 0;
        thbButtons[0].iBitmap = 0;
        thbButtons[0].dwFlags = THBF_HIDDEN;

        thbButtons[1].dwMask = dwMask;
        thbButtons[1].iId = 1;
        thbButtons[1].iBitmap = 2;
        thbButtons[1].dwFlags = THBF_HIDDEN;

        thbButtons[2].dwMask = dwMask;
        thbButtons[2].iId = 2;
        thbButtons[2].iBitmap = 3;
        thbButtons[2].dwFlags = THBF_HIDDEN;

        HRESULT hr = p_taskbl->ThumbBarSetImageList(winId(), himl );
        if(S_OK != hr)
            msg_Err( p_intf, "ThumbBarSetImageList failed with error %08lx", hr );
        else
        {
            hr = p_taskbl->ThumbBarAddButtons(winId(), 3, thbButtons);
            if(S_OK != hr)
                msg_Err( p_intf, "ThumbBarAddButtons failed with error %08lx", hr );
        }
        CONNECT( THEMIM->getIM(), playingStatusChanged( int ), this, changeThumbbarButtons( int ) );
    }
开发者ID:RicoP,项目名称:vlcfork,代码行数:74,代码来源:main_interface_win32.cpp


注:本文中的QBitmap::toWinHBITMAP方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。