Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Italian
  4. Disegnare forme in un Qframe
Forum Updated to NodeBB v4.3 + New Features

Disegnare forme in un Qframe

Scheduled Pinned Locked Moved Unsolved Italian
4 Posts 2 Posters 1.4k 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.
  • L Offline
    L Offline
    lucad93
    wrote on last edited by
    #1

    Ciao a tutti! Vorrei disegnare delle forme in un Qframe, che, se ho ben capito (sono agli inizi), è un frame "interno" ad un altro. In giro per il web ho trovato una serie di esempi per disegnare forme sull'intera finestra... come faccio a disegnarle "non sull'intera finestra"? Grazie

    VRoninV 1 Reply Last reply
    0
    • L lucad93

      Ciao a tutti! Vorrei disegnare delle forme in un Qframe, che, se ho ben capito (sono agli inizi), è un frame "interno" ad un altro. In giro per il web ho trovato una serie di esempi per disegnare forme sull'intera finestra... come faccio a disegnarle "non sull'intera finestra"? Grazie

      VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      @lucad93 said in Disegnare forme in un Qframe:

      se ho ben capito (sono agli inizi), è un frame "interno" ad un altro

      No, QFrame e' una cornice (o, al limite, un bordo). Cosa vorresti come risultato finale?

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lucad93
        wrote on last edited by
        #3

        Sostanzialmente vorrei poter cliccare su un pulsante, e da lì disegnare un cerchio in un -perdona la terminologia java- contentPane appena sopra. Ho letto, girando per il web, che QPainter non può essere invocato fuori dal paintEvent... non c'è un modo?

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          QPainter non può essere invocato fuori dal paintEvent

          falso ma diciamo che e' buona norma tenerlo li dentro.

          Quello che puoi fare e' registarre lo stato e poi fere il disegno nel paintEvent. cioe', per esempio (qui immagino usa classe che eredita da QPushButton), dichiari come privato bool disegnaCerchio=false; poi nel costruttore metti connect(this,&QPushButton::clicked,[this]()->void{disegnaCerchio=!disegnaCerchio;});

          poi nel paintevent fai un if(disegnaCerchio) per sapere se disegnare o no

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          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