Results 1 to 3 of 3

Thread: How to create select and delete in qFrame?

  1. #1
    Join Date
    Sep 2019
    Posts
    7
    Thanks
    3
    Qt products
    Qt5
    Platforms
    MacOS X

    Default How to create select and delete in qFrame?

    I have created the program that when clicked the button the picture will show on QFrame but I don't know how to create Function that can select the picture and delete them?


    here is my code:
    DragWidget:ragWidget(QWidget *parent)
    : QFrame(parent)
    {
    QToolBar *pToolBar = new QToolBar(this);
    m_ActADD = new QAction(this);
    m_ActADD->setIcon(QIcon(":/images/add.png"));
    connect(m_ActADD, &QAction::triggered, this, &DragWidget::addLableStrip);
    m_ActRemove = new QAction(this);
    m_ActRemove->setIcon(QIcon(":/images/remove.png"));
    connect(m_ActRemove, &QAction::triggered, this, &DragWidget::addLableStrip);

    pToolBar->addAction(m_ActADD);
    pToolBar->addAction(m_ActRemove);
    setMinimumSize(700, 700);
    setFrameStyle(QFrame::Sunken | QFrame::StyledPanel);
    setAcceptDrops(true);

    }

    void DragWidget::addLableStrip(){
    QLabel *boatIcon = new QLabel(this);
    boatIcon->setPixmap(QPixmap(":/images/strip"));
    boatIcon->move(10, 50 + moved);
    moved += 70;
    boatIcon->show();
    boatIcon->setAttribute(Qt::WA_DeleteOnClose);
    }

    Screen Shot 2562-09-09 at 15.00.35.jpgScreen Shot 2562-09-09 at 15.00.35.jpg

    the green button is for add the picture
    and the red button for delete the picture (this button I want to create the fucntion that can selete and delete the picture)

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,553
    Thanks
    13
    Thanked 1,580 Times in 1,509 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to create select and delete in qFrame?

    Perhaps you may want to consider QListWidget (or QListView with a model) in IconMode.

  3. The following user says thank you to ChrisW67 for this useful post:

    akkarachai (9th September 2019)

  4. #3
    Join Date
    Sep 2019
    Posts
    7
    Thanks
    3
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: How to create select and delete in qFrame?

    thank you for your answer.

    could you give me some example?

    sorry i'm rookie.
    Last edited by akkarachai; 9th September 2019 at 11:20.

Similar Threads

  1. Delete and re-create Qt Designer generated widgets
    By quimnuss in forum Qt Programming
    Replies: 7
    Last Post: 25th August 2015, 22:12
  2. Replies: 3
    Last Post: 24th August 2015, 22:51
  3. how to select and delete for images
    By ganeshgladish in forum Newbie
    Replies: 4
    Last Post: 26th June 2013, 17:12
  4. Replies: 0
    Last Post: 14th October 2010, 19:45
  5. Replies: 3
    Last Post: 8th September 2008, 19:18

Tags for this Thread

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.