Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Chinese
  4. 欢迎大家来到Qt中文论坛

欢迎大家来到Qt中文论坛

Scheduled Pinned Locked Moved Chinese
86 Posts 65 Posters 151.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hitzjm
    wrote on last edited by
    #38

    大家好,最近用pyside 编程,比较好用。但是前天 在程序里使用 Q_ARG 宏(用在C++程序里没有问题), pyside 不识别。有谁能帮助我吗。谢谢

    1 Reply Last reply
    0
    • C Offline
      C Offline
      chenmin
      wrote on last edited by
      #39

      我来拉
      [quote author="Xingtao Zhang" date="1312173268"]呵呵,有空就来转转。
      大牛们多发些技术贴啊。

      [quote author="Xingtao Zhang" date="1312000279"]那必须的! :)

      [quote author="Chuck Gao" date="1311946372"]
      [quote author="Xingtao Zhang" date="1311940164"]关注下,人气儿不怎么高啊![/quote]

      恩,目前才20个人,求给力!

      [/quote]

      [/quote]

      [/quote]

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cwang.nicolas
        wrote on last edited by
        #40

        报道一下

        1 Reply Last reply
        0
        • W Offline
          W Offline
          watchdog
          wrote on last edited by
          #41

          在这里一起做什么?有项目吗?

          1 Reply Last reply
          0
          • F Offline
            F Offline
            figo
            wrote on last edited by
            #42

            报道

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jiangcaiyang
              wrote on last edited by
              #43

              似乎不知道如何设置自己的头像……

              1 Reply Last reply
              0
              • T Offline
                T Offline
                toby520
                wrote on last edited by
                #44

                彩阳,哪里都有你的身影 哈哈,我也来啦,关注Qt,做Qter

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  jiangcaiyang
                  wrote on last edited by
                  #45

                  [quote author="toby520" date="1370487689"]彩阳,哪里都有你的身影 哈哈,我也来啦,关注Qt,做Qter[/quote]

                  是吗,为了官方论坛中文板块的兴旺,可以多在中文板块提问,我会尽我所能回答的。

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    realfan
                    wrote on last edited by
                    #46

                    凑个热闹,怎么换头像啊

                    1 Reply Last reply
                    0
                    • O Offline
                      O Offline
                      olunx
                      wrote on last edited by
                      #47

                      新人报道,哦耶。

                      1 Reply Last reply
                      0
                      • J Offline
                        J Offline
                        jayjie
                        wrote on last edited by
                        #48

                        捧场,捧场来啦,弱弱的问一下,那个视频怎么看不起喃

                        1 Reply Last reply
                        0
                        • J Offline
                          J Offline
                          jiangcaiyang
                          wrote on last edited by
                          #49

                          YouTube的视频在大陆看不起。
                          [quote author="jayjie" date="1374976398"]捧场,捧场来啦,弱弱的问一下,那个视频怎么看不起喃[/quote]

                          1 Reply Last reply
                          0
                          • E Offline
                            E Offline
                            eiao
                            wrote on last edited by
                            #50

                            新人报道~从百度贴吧过来...

                            1 Reply Last reply
                            0
                            • Z Offline
                              Z Offline
                              zixialang
                              wrote on last edited by
                              #51

                              I'm coming.

                              1 Reply Last reply
                              0
                              • L Offline
                                L Offline
                                liye0005
                                wrote on last edited by
                                #52

                                新人报道

                                1 Reply Last reply
                                0
                                • C Offline
                                  C Offline
                                  caochuanlong
                                  wrote on last edited by
                                  #53

                                  我装的QT5.2,然后编译时提示没有compiler,请问该怎么弄呢?我时新手,呵呵

                                  1 Reply Last reply
                                  0
                                  • J Offline
                                    J Offline
                                    jekin
                                    wrote on last edited by
                                    #54

                                    一直不知有个中文的版块,一直用Qt遇到的问题是很多,因为英文表达比较差,所以很少提问,很多的问题都是靠自己反复阅读英文文档才搞明白,以后至少可以在这里向大家提提问。

                                    1 Reply Last reply
                                    0
                                    • T Offline
                                      T Offline
                                      the_maskedman
                                      wrote on last edited by
                                      #55

                                      新人来报个到.

                                      1 Reply Last reply
                                      0
                                      • H Offline
                                        H Offline
                                        hou_jiangzhen
                                        wrote on last edited by
                                        #56

                                        @
                                        #pragma once
                                        #ifndef HICONEDITOR_H
                                        #define HICONEDITOR_H
                                        #include <QWidget>
                                        //!@ HIConEditor 类描述
                                        //!@ 类名:HIConEditor
                                        //!@ 基类名:QWidget
                                        //!@ 文件名称:e:\DrawLine\test\HIConEditor.h
                                        //!@ 创建者:Administrator
                                        //!@ 创建时间: 2014/03/29 17:26:33
                                        //!@ 类描述:

                                        class HIConEditor:public QWidget
                                        {
                                        Q_OBJECT
                                        Q_PROPERTY(QImage iconImage READ GetIConImage WRITE SetIConImage)
                                        Q_PROPERTY(QColor penColor READ GetPenColor WRITE SetPenColor)
                                        Q_PROPERTY(int zoomFactor READ GetZoomFactor WRITE SetZoomFactor)
                                        public:
                                        HIConEditor(QWidget *pParent=0);

                                        void SetPenColor(const QColor &newColor);
                                        inline QColor GetPenColor()const{return m_curColor;}
                                        void SetIConImage(const QImage &newImage);
                                        inline QImage GetIConImage()const{return m_curImage;}
                                        void SetZoomFactor(const int nZoom);
                                        inline int GetZoomFactor()const{return m_nZoom;}

                                        //!@重写基类函数
                                        QSize sizeHint()const;

                                        //!@ 重写基类函数
                                        protected:
                                        void mousePressEvent(QMouseEvent * event);
                                        void mouseMoveEvent(QMouseEvent * event);
                                        void paintEvent(QPaintEvent * event);

                                        private:
                                        void SetImagePixel(const QPoint &ptPosition,bool bOpaque);
                                        QRect GetPixelRect( const int nX, const int nY);

                                        private:
                                        QColor m_curColor;
                                        QImage m_curImage;
                                        int m_nZoom;
                                        };

                                        #endif
                                        @
                                        @#include <QPainter>
                                        #include <QPaintEvent>
                                        #include "HIConEditor.h"
                                        HIConEditor::HIConEditor( QWidget pParent/=0*/ )
                                        :QWidget(pParent)
                                        {
                                        setAttribute(Qt::WA_StaticContents);
                                        setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
                                        m_curColor=Qt::black;
                                        m_nZoom=8;
                                        m_curImage=QImage(16,16,QImage::Format_ARGB32);//w,h
                                        m_curImage.fill(qRgba(0,0,0,0));
                                        }

                                        QSize HIConEditor::sizeHint() const
                                        {
                                        QSize qSize=m_nZoom*m_curImage.size();
                                        if (m_nZoom>=3)
                                        {
                                        qSize+=QSize(1,1);
                                        }
                                        return qSize;
                                        }

                                        void HIConEditor::SetPenColor( const QColor &newColor )
                                        {
                                        if (newColor != m_curColor)
                                        {
                                        m_curColor=newColor;
                                        }
                                        }

                                        void HIConEditor::SetIConImage( const QImage &newImage )
                                        {
                                        if (newImage !=m_curImage)
                                        {
                                        m_curImage=newImage.convertToFormat(QImage::Format_ARGB32);
                                        update();
                                        updateGeometry();
                                        }
                                        }

                                        void HIConEditor::SetZoomFactor( const int nZoom )
                                        {
                                        if (nZoom !=m_nZoom)
                                        {
                                        if (nZoom<1)
                                        {
                                        m_nZoom=nZoom;
                                        update();
                                        updateGeometry();
                                        }
                                        }
                                        }

                                        void HIConEditor::paintEvent( QPaintEvent * event )
                                        {
                                        QPainter painter(this);
                                        if (m_nZoom>=3)
                                        {
                                        painter.setPen(palette().foreground().color());
                                        for (int i=0;i<=m_curImage.width();i++)
                                        {
                                        painter.drawLine(m_nZoomi,0,m_nZoomi,m_nZoomm_curImage.height());
                                        }
                                        for(int i=0;i<=m_curImage.height();i++)
                                        {
                                        painter.drawLine(0,m_nZoom
                                        i,m_nZoomm_curImage.width(),m_nZoomi);
                                        }
                                        }
                                        for(int i=0;i<m_curImage.width();i++)
                                        {
                                        for(int j=0;j<m_curImage.height();j++)
                                        {
                                        QRect rect=GetPixelRect(i,j);
                                        if (!event->region().intersect(rect).isEmpty())
                                        {
                                        QColor color=QColor::fromRgba(m_curImage.pixel(i,j));
                                        if (color.alpha()<255)
                                        {
                                        painter.fillRect(rect,Qt::white);
                                        }
                                        else
                                        {
                                        painter.fillRect(rect,color);
                                        }
                                        }
                                        }
                                        }
                                        }

                                        QRect HIConEditor::GetPixelRect( const int nX, const int nY )
                                        {
                                        if (m_nZoom>=3)
                                        {
                                        return QRect(m_nZoomnX+1,m_nZoomnY+1,m_nZoom-1,m_nZoom-1);//(x,y,w,h)
                                        }
                                        else
                                        {
                                        return QRect(m_nZoomnX,m_nZoomnY,m_nZoom,m_nZoom);
                                        }
                                        }

                                        void HIConEditor::mousePressEvent( QMouseEvent * event )
                                        {
                                        if (event->button()==Qt::LeftButton)
                                        {
                                        SetImagePixel(event->pos(),true);
                                        }
                                        else if (event->button()==Qt::RightButton)
                                        {
                                        SetImagePixel(event->pos(),false);
                                        }
                                        }

                                        void HIConEditor::SetImagePixel( const QPoint &ptPosition,bool bOpaque )
                                        {
                                        int i=ptPosition.x()/m_nZoom;
                                        int j=ptPosition.y()/m_nZoom;
                                        if (m_curImage.rect().contains(i,j))
                                        {
                                        if (bOpaque)
                                        {
                                        m_curImage.setPixel(i,j,GetPenColor().rgba());
                                        }
                                        else
                                        {
                                        m_curImage.setPixel(i,j,qRgba(0,0,0,0));
                                        }
                                        update(GetPixelRect(i,j));
                                        }
                                        }

                                        void HIConEditor::mouseMoveEvent( QMouseEvent * event )
                                        {
                                        if (event->buttons()&Qt::LeftButton)
                                        {
                                        SetImagePixel(event->pos(),true);
                                        }
                                        else if (event->buttons()&Qt::RightButton)
                                        {
                                        SetImagePixel(event->pos(),false);
                                        }
                                        }
                                        @
                                        @#pragma once
                                        #ifndef HICONEDITORPLUGIN_H
                                        #define HICONEDITORPLUGIN_H
                                        #include <QDesignerCustomWidgetInterface>
                                        class HIconEditorPlugin :public QObject,public QDesignerCustomWidgetInterface
                                        {
                                        Q_OBJECT
                                        Q_INTERFACES(QDesignerCustomWidgetInterface) //告知qt这个类实现的是QDesignerCustomWidgetInterface接口
                                        public:
                                        HIconEditorPlugin(QObject*pParent=0);

                                        //!@ 重写
                                        QString name()const;
                                        //!@ 重写
                                        QString includeFile()const;
                                        //!@ 重写
                                        QString group()const;
                                        //!@ 重写
                                        QIcon icon()const;
                                        //!@ 重写
                                        QString toolTip()const;
                                        //!@ 重写
                                        QString whatsThis()const;
                                        //!@ 重写
                                        bool isContainer()const;
                                        //!@ 重写
                                        QWidget createWidget(QWidget parent);
                                        };
                                        #endif
                                        @
                                        @
                                        #include "HIconEditorPlugin.h"
                                        #include "HIConEditor.h"
                                        #include "qplugin.h"
                                        HIconEditorPlugin::HIconEditorPlugin( QObject
                                        pParent/
                                        =0*/ )
                                        :QObject(pParent)
                                        {

                                        }

                                        QString HIconEditorPlugin::name() const
                                        {
                                        return "HIConEditor";
                                        }

                                        QString HIconEditorPlugin::includeFile() const
                                        {
                                        return "HIConEditor.h";
                                        }

                                        QString HIconEditorPlugin::group() const
                                        {
                                        return tr("Image Manipulation Widgets");
                                        }

                                        QIcon HIconEditorPlugin::icon() const
                                        {
                                        return QIcon(":/images/iconeditor.png");
                                        }

                                        QString HIconEditorPlugin::toolTip() const
                                        {
                                        return tr("An icon editor widget");
                                        }

                                        QString HIconEditorPlugin::whatsThis() const
                                        {
                                        return tr("This widget is presented in Chapter 5 of <i>C++ GUI"
                                        "Programming with Qt 4</i> as example of a custom Qt"
                                        "widget.");
                                        }

                                        bool HIconEditorPlugin::isContainer() const
                                        {
                                        return false;
                                        }

                                        QWidget * HIconEditorPlugin::createWidget( QWidget *parent )
                                        {
                                        return new HIConEditor(parent);
                                        }
                                        Q_EXPORT_PLUGIN2(hiconeditorplugin,HIconEditorPlugin)@

                                        为什么下面这个QImage属性在QDesigner设计器中不显示,而其他定义的属性正常显示。
                                        !C:\Users\Administrator\Desktop\QQ图片20140330192657.jpg(F:\QQ图片20140330192657.jpg)!Q_PROPERTY(QImage iconImage READ GetIConImage WRITE SetIConImage)

                                        1 Reply Last reply
                                        0
                                        • Q Offline
                                          Q Offline
                                          qq897425998
                                          wrote on last edited by
                                          #57

                                          今天才发现 官网资源 这么丰富 以后就用官的论坛了

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved