Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]Using QTextEdit multiple times
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]Using QTextEdit multiple times

Scheduled Pinned Locked Moved General and Desktop
12 Posts 2 Posters 3.5k Views 1 Watching
  • 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.
  • B Offline
    B Offline
    b1gsnak3
    wrote on last edited by
    #1

    Hello!

    I have encountered a possible bug, maybe there is a resolution for this problem so I thought I should post it here first, and then in the bugtracker.

    Therefore:

    I am using around 16 QTextEdit objects in my window to display various information which must be able to be copied via copy/paste from Windows. However, when I try to copy this, my application crashes on multiple systems. If I do not try to copy everything works fine, i get all the data and display it correctly. Anyone else encountered this problem or am I the only one? :)

    Thank you for your help nonetheless.

    Qt 5.1.1 Windows 7 Proffesional x86, MSVC2010

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      Hi,
      How does your code looks like? Isn't there a bug in your copy/paste algorithm??? Don't blame Qt until your absolute sure ;-)

      Greetz, Jeroen

      1 Reply Last reply
      0
      • B Offline
        B Offline
        b1gsnak3
        wrote on last edited by
        #3

        I did not modify anything on the copy/paste i let the Framework handle this... I just use setFixedSize for each element, and append strings when a button is clicked :)

        1 Reply Last reply
        0
        • B Offline
          B Offline
          b1gsnak3
          wrote on last edited by
          #4

          bumpiddy bumpiddy bump

          1 Reply Last reply
          0
          • JeroentjehomeJ Offline
            JeroentjehomeJ Offline
            Jeroentjehome
            wrote on last edited by
            #5

            Ok, place your code, You might use pointers that are unavailable etc.
            Greetz

            Greetz, Jeroen

            1 Reply Last reply
            0
            • B Offline
              B Offline
              b1gsnak3
              wrote on last edited by
              #6

              Correct me if I'm wrong, but using pointers that are unavailable wouldn't crash the app when I'm using those pointers? My window displays normally untill I try to use Copy on the text displayed on any of the QTextEdit objects that have text in them... And another fun fact is that this is a multiple window app, and on one other window the QTextEdit works fine, this is why i am assuming it is because I am using multiple QTextEdit objects in one window... The code is not so complicated, it just has a header with the declaration of all objects, a source file with the allocation of each object (16 labels, 16 buttons and 16 text edits) with 16 slots that are only called for each button press... Again it is not in my code the error, because I can close / open the window as many times i want, but only if I try to copy the text will it result in a crash...

              1 Reply Last reply
              0
              • JeroentjehomeJ Offline
                JeroentjehomeJ Offline
                Jeroentjehome
                wrote on last edited by
                #7

                I still don't believe it's the QTextEdit class that is at fault. Why would it?? The copy function copies data to the notepad/temp holder. Then when pasting it should be available to anyone pasting it. So, no code, no proper answer ;-)
                I'll test it here, simple form, two textedits and let's see if it crashes..........
                btw, just because you don't share code, do you use the canPaste() function??
                Nup, no problem on my end!!!! Two QTextBrowsers next to each other, I'm able to paste without crashes etc!!! Check your code, it's faulty!

                Greetz, Jeroen

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  b1gsnak3
                  wrote on last edited by
                  #8

                  After fiddling around with the debugger i saw that it throws an exception at line 289 in qwindowsclipboard.cpp, which is:

                  @
                  QString mimeDataFormats = mimeData ?
                  mimeData->formats().join(QStringLiteral(", ")) : QString(QStringLiteral("NULL"));
                  @

                  1 Reply Last reply
                  0
                  • JeroentjehomeJ Offline
                    JeroentjehomeJ Offline
                    Jeroentjehome
                    wrote on last edited by
                    #9

                    Like I said, it isn't Qt to blame ;-)
                    Why do you need to alter the input text?? Adding the , character? How does the rest of that function look like?
                    Shouldn't you also check the hasformats() function on the mimeData? And how do you fill the mimeData pointer (if it's a pointer at all??)
                    More code to be of any assistance!

                    Greetz, Jeroen

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      b1gsnak3
                      wrote on last edited by
                      #10

                      That is from the Qt standard classes. Not from one of my own classes. That is where the debugger shows an exception... The odd part is that when i tried to reproduce the error I couldn't... I do not need to alter the text, it is text that i receive from Win32 API classes (Like owner name etc) and I convert from Variant (because i have different CIMTYPEs) and I save them in QString or QStringList depending on the method, after which I display them... When I try to copy from the QTextEdit objects, it crashes... Which is weird... I tried to add simple text but it didn't work either... I am stumped

                      1 Reply Last reply
                      0
                      • JeroentjehomeJ Offline
                        JeroentjehomeJ Offline
                        Jeroentjehome
                        wrote on last edited by
                        #11

                        This is a pretty big issue now, only with the complete program or at least more source code someone may be of assistance. Good luck with this issue. Maybe you need to change some things and try a different approach? Maybe specify why you need the copy/paste with so many QTextEditors, btw QTextBrowser is the more modern class to use. Some text functions have been added to QTextEditor

                        Greetz, Jeroen

                        1 Reply Last reply
                        0
                        • B Offline
                          B Offline
                          b1gsnak3
                          wrote on last edited by
                          #12

                          Nevermind... I am kinda dumb... Had a CoUninitialize() call that screw me over... :) Thx for your time though :)

                          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