Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to put a pixel on window?

How to put a pixel on window?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
pixel dot
4 Posts 2 Posters 2.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.
  • hjparkH Offline
    hjparkH Offline
    hjpark
    wrote on last edited by
    #1

    Hi Guys..

    I want to draw a RGB pixel on a window.
    but.. I dont find an API like a putPixel on C lib.

    Could you let me know how to put a RGB pixel on a window?
    thanks a lot
    HJ

    ? 1 Reply Last reply
    0
    • hjparkH hjpark

      Hi Guys..

      I want to draw a RGB pixel on a window.
      but.. I dont find an API like a putPixel on C lib.

      Could you let me know how to put a RGB pixel on a window?
      thanks a lot
      HJ

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      @hjpark Hi, and welcome to the Qt forum! Simply derive from QWidget and override its paintEvent method. You can then draw whatever you want inside there.

      hjparkH 1 Reply Last reply
      0
      • ? A Former User

        @hjpark Hi, and welcome to the Qt forum! Simply derive from QWidget and override its paintEvent method. You can then draw whatever you want inside there.

        hjparkH Offline
        hjparkH Offline
        hjpark
        wrote on last edited by hjpark
        #3

        @Wieland Thanks a lot for your help.. I succeeded to draw a point with this code but I have to draw a point whenever getting some datas from a USB device. but, I don't know how to raise paintEvent manually when I want.
        It seems to be called when the widget showed but I don't know how to call paintEvent when I get a data from USB devie. pls help me again . thanks a lot.

        void Widget::paintEvent(QPaintEvent *event)
        {
        Q_UNUSED(event);

        QPainter painter;
        painter.begin(this);
        
        painter.setPen(Qcloor(10,10,10);
        painter.drawPoint(10,10);
        painter.end();
        

        }

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          Once you received new data and want the widget to be painted again just call this function on it: [slot] void QWidget::update(), see also: QWidget Class.

          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