Geometrize  1.0
An application for geometrizing images into geometric primitives
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
geometrize::dialog::RecentTasksList Class Reference

The RecentTasksList class models the UI for a list of recently opened tasks. More...

#include <recenttaskslist.h>

Inheritance diagram for geometrize::dialog::RecentTasksList:
Inheritance graph
[legend]
Collaboration diagram for geometrize::dialog::RecentTasksList:
Collaboration graph
[legend]

Classes

class  RecentTasksListImpl
 

Public Member Functions

 RecentTasksList (QWidget *parent=nullptr)
 
virtual ~RecentTasksList ()
 
void setRecentItems (RecentItems *items)
 setRecentItems Sets the items that the list will keep track of. More...
 

Static Public Member Functions

static QString getDisplayNameForTaskPath (const QUrl &url)
 getDisplayNameForTaskPath Extracts a display name suitable for displaying to the user from the task URL/file path. More...
 

Protected Member Functions

void changeEvent (QEvent *) override
 

Private Member Functions

virtual void keyPressEvent (QKeyEvent *e) override
 

Private Attributes

std::unique_ptr< RecentTasksListImpld
 

Detailed Description

The RecentTasksList class models the UI for a list of recently opened tasks.

Constructor & Destructor Documentation

◆ RecentTasksList()

geometrize::dialog::RecentTasksList::RecentTasksList ( QWidget *  parent = nullptr)
explicit
173  : QListWidget(parent), d{std::make_unique<RecentTasksList::RecentTasksListImpl>(this)}
174 {
175 }

◆ ~RecentTasksList()

geometrize::dialog::RecentTasksList::~RecentTasksList ( )
virtual
178 {
179 }

Member Function Documentation

◆ changeEvent()

void geometrize::dialog::RecentTasksList::changeEvent ( QEvent *  event)
overrideprotected
209 {
210  if (event->type() == QEvent::LanguageChange) {
211  d->onLanguageChange();
212  }
213  QWidget::changeEvent(event);
214 }

◆ getDisplayNameForTaskPath()

QString geometrize::dialog::RecentTasksList::getDisplayNameForTaskPath ( const QUrl &  url)
static

getDisplayNameForTaskPath Extracts a display name suitable for displaying to the user from the task URL/file path.

Parameters
urlThe URL pointing to the task (could be a local file, a webpage, a file from a template or sample, whatever).
Returns
A display name for the task, suitable for showing to the user in the recent tasks list.
187 {
189 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ keyPressEvent()

void geometrize::dialog::RecentTasksList::keyPressEvent ( QKeyEvent *  e)
overrideprivatevirtual
192 {
193  QListWidget::keyPressEvent(e);
194 
195  const QList<QListWidgetItem*> items{selectedItems()};
196 
197  if(e->matches(QKeySequence::Copy)) {
198  QStringList strings;
199  for(const QListWidgetItem* item : items) {
200  strings.push_back(item->text());
201  }
202  QApplication::clipboard()->setText(strings.join("\n"));
203  } else if(e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace) {
204  d->removeItemDataAndMenuItems(items);
205  }
206 }

◆ setRecentItems()

void geometrize::dialog::RecentTasksList::setRecentItems ( RecentItems items)

setRecentItems Sets the items that the list will keep track of.

Parameters
itemsThe list of items, the recent tasks list does not take ownership of this.
182 {
183  d->setRecentItems(recents);
184 }

Member Data Documentation

◆ d

std::unique_ptr<RecentTasksListImpl> geometrize::dialog::RecentTasksList::d
private

The documentation for this class was generated from the following files:
geometrize::dialog::RecentTasksList::RecentTasksListImpl::getDisplayNameForTaskPath
static QString getDisplayNameForTaskPath(const QUrl &url)
Definition: recenttaskslist.cpp:37
geometrize::dialog::RecentTasksList::d
std::unique_ptr< RecentTasksListImpl > d
Definition: recenttaskslist.h:50