from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtWidgets import QDialog, QVBoxLayout, QWidget

from oslandia.datamodels.mdl_projects_browser import ProjectObj
from oslandia.gui.showcase.wdg_showcase_project import ShowcaseProjectWidget


class ClickCardProjectDialog(QDialog):
    """A borderless dialog box in popup mode that displays the contents of a widget."""

    def __init__(self, project: ProjectObj, parent: QWidget | None = None) -> None:
        super().__init__(parent)
        self.setWindowFlags(Qt.WindowType.Popup)

        layout = QVBoxLayout(self)

        self.wdg_project = ShowcaseProjectWidget(self)
        self.wdg_project.set_display_data(project)
        layout.addWidget(self.wdg_project)
