{ "cells": [ { "cell_type": "markdown", "id": "a2c060b4", "metadata": {}, "source": [ "# 2.01 QComponent lifecycle — use, copy, delete, rename\n" ] }, { "cell_type": "markdown", "id": "28c061ba", "metadata": {}, "source": [ "[](https://colab.research.google.com/github/qiskit-community/qiskit-metal/blob/main/docs/tut/2-From-components-to-chip/2.01-How-to-use-a-QComponent.ipynb)\n", "[](https://mybinder.org/v2/gh/qiskit-community/qiskit-metal/main?labpath=docs%2Ftut%2F2-From-components-to-chip%2F2.01-How-to-use-a-QComponent.ipynb)\n", "\n", "> 💡 **Running in Colab or Binder?** Skip the desktop GUI install — the cell below grabs the lite (no-Qt) wheel, and `qm.gui(design)` auto-picks an inline matplotlib viewer with the same API (`gui.rebuild()`, `gui.screenshot()`, `gui.edit_component(...)`) as the desktop `MetalGUI`." ] }, { "cell_type": "code", "execution_count": 1, "id": "adeaa4b6", "metadata": { "execution": { "iopub.execute_input": "2026-08-08T05:25:37.909758Z", "iopub.status.busy": "2026-08-08T05:25:37.909509Z", "iopub.status.idle": "2026-08-08T05:25:37.914103Z", "shell.execute_reply": "2026-08-08T05:25:37.913580Z" } }, "outputs": [], "source": [ "# In Colab / Binder, uncomment to install Quantum Metal (lite, no Qt).\n", "# Locally you should already have it via `pip install quantum-metal` or\n", "# `pip install 'quantum-metal[gui]'` for the desktop GUI.\n", "# !pip install -q quantum-metal" ] }, { "cell_type": "markdown", "id": "5a95580a", "metadata": {}, "source": [ "> 💡 **Using this tutorial without the Qt GUI**\n", "> \n", "> This tutorial uses the desktop `MetalGUI`. To follow along on Colab, Binder, JupyterHub, or any environment where Qt isn't available, **replace any `gui.rebuild()` / `gui.screenshot()` call with `qm.view(design)`** — it renders the design to a matplotlib `Figure` you can display inline or save with `fig.savefig(...)`.\n", "> \n", "> See [1.1 Quick start](https://qiskit-community.github.io/qiskit-metal/tut/1-Overview/1.1-Quick-start.html) for a complete runnable walkthrough and [`docs/headless-usage.rst`](https://qiskit-community.github.io/qiskit-metal/headless-usage.html) for the full reference." ] }, { "cell_type": "markdown", "id": "abf3a9ad", "metadata": {}, "source": [ "Now, let's import Qiskit Metal:" ] }, { "cell_type": "code", "execution_count": 2, "id": "4ca6c55e", "metadata": { "execution": { "iopub.execute_input": "2026-08-08T05:25:37.916896Z", "iopub.status.busy": "2026-08-08T05:25:37.916739Z", "iopub.status.idle": "2026-08-08T05:25:39.134730Z", "shell.execute_reply": "2026-08-08T05:25:39.134223Z" } }, "outputs": [ { "data": { "text/html": [ "\n", "