Results 1 to 6 of 6

Thread: How to copy from Excel and paste to QTableView

  1. #1
    Join Date
    Jun 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Question How to copy from Excel and paste to QTableView

    Hello everyone,

    I already manage to copy rows and column data from QTableView to Excel. Using QApplication::clipboard() and QMimeData classes. I use ctrl +c to call the method to copy to clipboard and ctrl +v to paste. This last one is the default shortcut.

    But I am stuck now , I cant find out the way to do it the other way around. I use ctrl +c from excel to copy to clipboard but ctrl +v doesnt do anything to QTableView.
    I though it could be a problem related to flags. I set setAcceptDrops(true), then I thought about setDragDropMode(QAbstractItemView:ropOnly) ( I dont want drag enable because i use my own types for the table items and It crashes if I only drag and drop items.

    HElP with hints. Can I find and example anywhere?
    Thanks in advance

  2. #2
    Join Date
    Jul 2006
    Location
    Atlanta, GA
    Posts
    86
    Thanks
    26
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to copy from Excel and paste to QTableView

    Check out the C++ GUI Programming with Qt4 book. Google has it scanned in here. That book pretty much teaches how to create a spreadsheet app.
    fnmblot
    --------------------------------------
    Gee Ricky, I'm sorry your mom blew up.

  3. #3
    Join Date
    Jun 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to copy from Excel and paste to QTableView

    Thanks fnmblot
    This hint was very helpful! I found what I was looking for...

  4. #4
    Join Date
    Oct 2008
    Location
    Europe
    Posts
    37
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to copy from Excel and paste to QTableView

    Can you please tell me how do you paste from excel to qt ?

  5. #5

    Default Re: How to copy from Excel and paste to QTableView

    Can you please tell me how do you paste from excel to qt ? ( sample code will help me )

  6. #6
    Join Date
    Apr 2008
    Location
    São José dos Campos, São Paulo, Brazil
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to copy from Excel and paste to QTableView

    You need to see how excel save its selection to the clipboard, then handle it.

    If you want Qt -> excel, just use \t for column and \n for line, excel will understand it.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.